*.php = ERROR 500

Discussion in 'General' started by czaczawik, Jan 24, 2012.

  1. czaczawik

    czaczawik New Member

    Hi
    Im just start with ISPC and VPS and have (propably) easy question.
    I was add client and site for him. Site works fine but only with html files. When i put on server even simple php file ( phpinfo(); ) then i got error:

    Code:
    ERROR 500 - Internal Server Error!
    The following error occurred:
    The requested URL caused an internal server error.
    If you get this message repeatedly please contact the webmaster.
    in /var/log/apache2/suexec.log i found

    Code:
    [2012-01-24 17:41:04]: uid: (5004/web1) gid: (5005/client1) cmd: .php-fcgi-starter
    [2012-01-24 17:41:04]: (13)Permission denied: exec failed (.php-fcgi-starter)
    Please, help for noob. Tell me like for child what to do
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Your PHP file is probably owned by the wrong user and/or group.
     
  3. czaczawik

    czaczawik New Member

    /var/www/php-fcgi-scripts/web1/*.php-fcgi-starter

    Code:
    File:  .php-fcgi-starter
    Owner: web1/client1
    Mode: -rwxr-xr-r (755)
    Code:
    $1
    #!/bin/sh
    PHPRC="/etc/php5/cgi/"
    export PHPRC
    PHP_DOCUMENT_ROOT="/var/www/clients/client1/web1"
    export PHP_DOCUMENT_ROOT
    # The variable PHP_FCGI_CHILDREN is onyl useful for lighty or nginx as apache
    # mod_fcgi will control the number of childs themself and never use the additional processes.
    # PHP_FCGI_CHILDREN=8
    # export PHP_FCGI_CHILDREN
    PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_MAX_REQUESTS
    exec /usr/bin/php-cgi \
    -d open_basedir="/var/www/clients/client1/web1/web:/var/www/clients/client1/web1/tmp:/var/www/szalpal.pl/web:/srv/www/szalpal.pl/web:/usr/share/php5:$
    -d upload_tmp_dir=/var/www/clients/client1/web1/tmp \
    -d session.save_path=/var/www/clients/client1/web1/tmp \
    im still dont know what to do
     
  4. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Falko meant the php files in the web directory, not the starter script
     
  5. maumar

    maumar New Member HowtoForge Supporter

    I have the same issue

    how should access rigths on web dir?
    chmod 755? or chmod 750? or what?

    many many thnx :)
     
  6. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    A 500 error can have many different reasons. Please post the exact error message that you get in the error.log fileof the website.
     
  7. maumar

    maumar New Member HowtoForge Supporter

  8. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    What about the error log?
     
  9. maumar

    maumar New Member HowtoForge Supporter

    the erro log reports the usual
    Code:
    [Mon Mar 05 17:15:37 2012] [error] [client x.x.x.x] Premature end of script headers: index.php
    
    and suexec.log
    Code:
    [2012-03-05 17:15:37]: uid: (xxxx/zzzzz) gid: (zzz/zzzz) cmd: .php-fcgi-starter
    [2012-03-05 17:15:37]: (13)Permission denied: exec failed (.php-fcgi-starter)
    
    i solved reverting to apache mod-php;
    the server was attacked the day before and they installed many perl scripts, maybe that cleaning massively something was wiped off, sadly
    thnx for help :)
     
  10. maumar

    maumar New Member HowtoForge Supporter

    Ok, now I have logs
    debian squeeze and ispconfig 3.0.4.3
    domain is obscured with xxx.xx

    this is suexec.log
    Code:
    [2012-03-25 13:00:49]: uid: (1006/web5) gid: (1014/client34) cmd: .php-fcgi-starter
    [2012-03-25 13:00:49]: (13)Permission denied: exec failed (.php-fcgi-starter)
    
    these are the rights i setupped:
    Code:
    /var/www/clients/client34/web5 # ls -la    
    total 104
    drwxr-x--x 6 web5 client34  4096 Mar 25 00:46 .
    drwxr-xr-x 7 root root      4096 Mar 15 17:42 ..
    -rw------- 1 web5 client34    14 Mar 12 17:29 .ftpquota
    -rwxr-xr-x 1 root root        40 Oct 23 14:31 .htpasswd_stats
    lrwxrwxrwx 1 root root        16 Mar 25 00:46 backup -> /var/backup/web5
    drwxr-x--x 2 web5 client34  4096 Oct 17 18:07 cgi-bin
    lrwxrwxrwx 1 web5 client34    40 Oct 17 18:07 log -> /var/log/ispconfig/httpd/xxx.xx
    drwxr-x--x 2 web5 client34  4096 Oct 17 18:07 ssl
    drwxrwxrwx 2 web5 client34 77824 Mar 25 12:04 tmp
    drwxr-x--- 8 web5 client34  4096 Mar 12 17:29 web
    
    then
    Code:
    chown -R web5:client34 ./web
    chmod -R 750 ./web
    
    error_log
    Code:
    [Sun Mar 25 14:01:52 2012] [warn] [client 79.33.66.85] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
    [Sun Mar 25 14:01:52 2012] [error] [client 79.33.66.85] Premature end of script headers: index.php
    

    this is /var/www/php-fcgi-scripts/web5/.php-fcgi-starter
    Code:
    ls -la  /var/www/php-fcgi-scripts/web5/.php-fcgi-starter
    -rwxr-xr-x 1 web5 client34 768 Mar 25 14:00 /var/www/php-fcgi-scripts/web5/.php-fcgi-starter
    
    cat /var/www/php-fcgi-scripts/web5/.php-fcgi-starter
    #!/bin/sh
    PHPRC="/etc/php5/cgi/"
    export PHPRC
    PHP_DOCUMENT_ROOT="/var/www/clients/client34/web5"
    export PHP_DOCUMENT_ROOT
    # The variable PHP_FCGI_CHILDREN is onyl useful for lighty or nginx as apache 
    # mod_fcgi will control the number of childs themself and never use the additional processes.
    # PHP_FCGI_CHILDREN=8
    # export PHP_FCGI_CHILDREN
    PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_MAX_REQUESTS
    exec /usr/bin/php-cgi \
     -d open_basedir="/var/www/clients/client34/web5/web:/var/www/clients/client34/web5/tmp:/var/www/xxx.xx/web:/srv/www/xxx.xx/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin" \
    -d upload_tmp_dir=/var/www/clients/client34/web5/tmp \
    -d session.save_path=/var/www/clients/client34/web5/tmp \
     $1
    /var/www/php-fcgi-scripts/web5/.php-fcgi-starter (END) 
    
    this is index.php
    Code:
     ls -la web/index.php 
    -rwxr-x--- 1 web5 client34 397 Mar 12 17:12 web/index.php
    
    with chmod 755 still the same error:
    Code:
    /var/www/clients/client34/web5 # chmod -R 755 web/
    [2012-03-25 14:32:51]: uid: (1006/web5) gid: (1014/client34) cmd: .php-fcgi-starter
    [2012-03-25 14:32:51]: (13)Permission denied: exec failed (.php-fcgi-starter)
    [2012-03-25 14:36:18]: uid: (1006/web5) gid: (1014/client34) cmd: .php-fcgi-starter
    [2012-03-25 14:36:18]: (13)Permission denied: exec failed (.php-fcgi-starter)
    
    

    Question is:
    what are the correct rights?
     
    Last edited: Mar 25, 2012
  11. maumar

    maumar New Member HowtoForge Supporter

    raising LogLevel at max, debug level i get

    tail -f /var/log/apache2/error.log
    Code:
    [Sun Mar 25 14:58:04 2012] [info] mod_fcgid: server xxx.xx/var/www/php-fcgi-scripts/web5/.php-fcgi-starter(9793) started
    suexec policy violation: see suexec log for more details
    
     
  12. maumar

    maumar New Member HowtoForge Supporter

    I wuold addthat all the domains at the moment are running with suexec & suPHP w/out any issue.
    As someone suggested me, fcgid is faster and consumes much less cpu than suPHP, i tried to chenge by suPHP to fcgid.
    As far as i can see, suexec is ok with suPHP, then there is no issue with suexec.

    At the moment I am trying to compare this server configuration with another web multiserver node, where the domains are running with fcgid without any issue.

    I will report any other improvment on my search.
     

Share This Page