suphp from fastcgi causes 500 error

Discussion in 'Installation/Configuration' started by wolfric, Aug 19, 2011.

  1. wolfric

    wolfric New Member

    <code>
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined variable: page_form in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 497, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Trying to get property of non-object in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 497, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined variable: page_form in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 498, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Trying to get property of non-object in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 498, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined variable: page_form in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 499, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Trying to get property of non-object in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 499, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined variable: page_form in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 500, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Trying to get property of non-object in /usr/local/ispconfig/interface/web/sites/web_domain_edit.php on line 500, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined index: on_after_update in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 140, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined index: sites:eek:n_after_update in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 140, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined index: sites:web_domain:eek:n_after_update in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 140, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:45:36 2011] [warn] [client 192.168.1.37] mod_fcgid: stderr: PHP Notice: Undefined index: return_to_url in /usr/local/ispconfig/interface/lib/classes/tform_actions.inc.php on line 142, referer: http://192.168.1.35:8080/index.php
    [Fri Aug 19 21:46:02 2011] [notice] caught SIGTERM, shutting down
    [Fri Aug 19 21:46:03 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
    [Fri Aug 19 21:46:03 2011] [notice] Digest: generating secret for digest authentication ...
    [Fri Aug 19 21:46:03 2011] [notice] Digest: done
    [Fri Aug 19 21:46:03 2011] [notice] Apache/2.2.16 (Debian) DAV/2 mod_fcgid/2.3.6 mod_ruby/1.2.6 Ruby/1.8.7(2010-08-16) mod_ssl/2.2.16 OpenSSL/0.9.8o configured -- resuming normal operations


    </code>

    when i go to sites as admin user, go to fastcars.com (testing website i created), and change the php version from fastcgi to suphp, i get 500 errors and this in /var/log/apache/error.log. I've installed suphp and disabled php5 via a2dismod php5 and restarted apache.
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Are your PHP scripts owned by the correct suExec user and group?
     
  3. wolfric

    wolfric New Member

    I think so... web1:client1 right?

    It's the same as it is when the default files are created.


    -rwxr-xr-- 1 web1 client1 1865 Aug 19 21:54 index.php

    note, when it's index.php it's a 500 error (even if no php resides in the file) but if it's index.html, it works fine.

    It sounds like it can't contact suphp or something.
     
  4. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Can you try
    Code:
    chmod 755 index.php
    ?

    Did you check the web site's error log?
     
  5. wolfric

    wolfric New Member

    Tried 755 and 777 and even with 777 it still comes up with that error.
    I've checked in /var/log/apache2/(access.log,error.log,suexec.log and other_vhosts_access.log)

    The only thing that shows when i try access the page that's throwing the 500 error, is an access.log entry. I think the error in the first post i made was only when i attempted to change the php option in ispconfig.
     
  6. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Can you post your /etc/suphp.conf?

    Are permissions of all directories up to index.php correct?
     
  7. wolfric

    wolfric New Member

    Code:
    [global]
    ;Path to logfile
    logfile=/var/log/suphp/suphp.log
    
    ;Loglevel
    loglevel=info
    
    ;User Apache is running as
    webserver_user=www-data
    
    ;Path all scripts have to be in
    ;docroot=/var/www:${HOME}/public_html
    dochroot=/var/www
    
    ;Path to chroot() to before executing script
    ;chroot=/mychroot
    
    ; Security options
    allow_file_group_writeable=false
    allow_file_others_writeable=false
    allow_directory_group_writeable=false
    allow_directory_others_writeable=false
    
    ;Check wheter script is within DOCUMENT_ROOT
    check_vhost_docroot=true
    
    ;Send minor error messages to browser
    errors_to_browser=false
    
    ;PATH environment variable
    env_path=/bin:/usr/bin
    
    ;Umask to set, specify in octal notation
    umask=0022
    
    ; Minimum UID
    min_uid=100
    
    ; Minimum GID
    min_gid=100
    
    
    [handlers]
    ;Handler for php-scripts
    application/x-httpd-suphp="php:/usr/bin/php-cgi"
    
    ;Handler for CGI-scripts
    x-suphp-cgi="execute:!self"
    x-httpd-suphp="php:/usr/bin/php-cgi"
    
    
    Also tried

    dochroot=/var/www/clients/${GID}/${UID}/web
    and restarted apache and it didn't work either (same message)

    when i removed it or changed it back to what it originally was it worked... my bad. i think i saw dochroot=/var/www in a tutorial somewhere. Thanks for the help. Is there any reason why this didn't work though? it should have as far as I can see...

    Edit: for chrooting the user in their web directory, should i use
    chroot=/var/www/clients/${GID}/${UID}/web
    when i tried this, i get a 500 error like before. (this is different to dochroot which was just to get suphp to run - i assume the chroot option really does chroot the user in the directory)

    chroot should have been
    chroot=/var/www/clients/${GROUPNAME}/${USERNAME}/web however it still doesn't work my path is /var/www/clients/client1/web1/web
    id web1
    uid=5004(web1) gid=5005(client1) groups=5005(client1),5002(sshusers)


    I found new logs in /var/log/ispconfig/



    [Mon Aug 22 23:23:03 2011] [error] [client 192.168.1.37] SoftException in Application.cpp:537: Could not execute script "/var/www/clients/client1/web1/web/index.php"
    [Mon Aug 22 23:23:03 2011] [error] [client 192.168.1.37] Caused by SystemException in API_Linux.cpp:465: chdir() failed: No such file or directory
    [Mon Aug 22 23:23:03 2011] [error] [client 192.168.1.37] Premature end of script headers: index.php
     
    Last edited: Aug 23, 2011
  8. tek

    tek New Member

    Answering this more for everyone else

    You have obviously solved this but anyone running across this with a similar error may not understand whats up so this is for them.

    the problem was the directive you were using in the config file.

    you changed docroot into dochroot

    Apache needs to know where its documents are to be stored or as they call it its Document Root or docroot for short.

    In the actual apache.conf or httpd.conf for many rpm based system its usually pulled in by an Include statement that causes apache to parse all your virtual domains and modules that its supposed to load.

    Back in your sites-enabled folder inside of /etc/apache/ the master sites config file is the 000-default and to use that for this example it has a directive called
    DocumentRoot .... then it has a path statement.

    In the config you quoted it has no docroot hence one part of your problem.
    Apache needs to know where to find its documents then once it see's them and identifies the .php on the end it finds its handler type calling out the suphp.conf file but it has no docroot or homefolder declared so to speak.
     

Share This Page