suPHP 500 Internal Server Error

Discussion in 'Installation/Configuration' started by mattbrown, Aug 22, 2006.

  1. mattbrown

    mattbrown New Member

    Ive just setup ISPConfig and its looking lovelly all except my php seems to have stopped working when i installed ISPConfig

    I had a fresh install of FC4 and had mod_suphp running fine on apache2.0 now ive installed ISPConfig I get an Internal Server Error 500 when i try to access any .php files

    any ideas?

    a little more info

    Im wondering weather my setup was correct

    I installed FC4
    then yum install httpd
    yum install php
    yum install mod_suphp

    edit httpd.conf and add
    'AddHandler x-httpd-php .php'
    <Location />
    suPHP_Engine on

    And my phpinfo.php reports


    So I carried on and installed everything else, once ISPC was setup i created a website and uploaded my phpinfo.php file and this is when i get the 500 internal server error

    Last edited: Aug 22, 2006
  2. mattbrown

    mattbrown New Member

    Further Developments


    I've now had some more time to play around with this and have discovered that itdoes not seem to be a problem with the php setup but more of a permission problem

    when a file is uploaded by ftp it is given permissions of

    then when this file is accessed through a browser the following error is placed in my suphp log

    [Tue Aug 22 14:57:05 2006] [error] Script (/var/www/web2/web/index.php) is writeable by others

    however if i change the permossions of the file to

    755 rwxr-xr-x

    i get this and everything is fine

    [Tue Aug 22 15:06:19 2006] [info] Executing /var/www/web2/web/index.php as user web2_matt (10009), group web2 (10008)

    is i tpossible to change what permissions are assigned to a file when it is uploaded via ftp? i am using proftp

  3. till

    till Super Moderator Staff Member ISPConfig Developer

    The files are not writable by others, the files are writable by the website group of this (one) website.

    Please recompile your suphp and disable the group permission check.
  4. mattbrown

    mattbrown New Member

    What am I doing Wrong

    I have now compiled suphp so many time i ve lost count

    it just wont work

    First of all should I have a suphp.conf file in /etc

    I have never had one in there or anywhere else except /etc/httpd/conf.d and this appears to be where you set the

    ; Security options

    I have created one myself in /etc but it doesn't seem to do anything

    the only way I can get suphp to work successfully is to do

    yum install mod_suphp

    then add
    AddHandler x-httpd-php .php
    suPHP_Engine on
    to /etc/httpd.conf.httpd.conf

    this runs fine as long as the files permissions are 644 and strangely uses my php installation in /usr/php/bin (which i was under the impression is a cli version as reported by php -v) which is no good in this case

    if i compile it from scratch it just seems to do nothing

    I have built and installed a sepearte cgi version of php5 in /usr/php5 and it still does absolutely nothing if i compile from scratch.

    does anybody know if there is / should be a conf file using the yum install mod_suphp version??

    there also does not seem to be any option in ./configure to prevent it checking group write permissions, only in the supposed conf file.

    maybe I should be putting this file somewhere else on Fedora Core 4?

    any ideas??

  5. mattbrown

    mattbrown New Member

    still getting nowhere <sigh>


    I found this

    and decided to give it a go

    and indeed it has created for my a /etc/suphp.conf and all the trimmings but now when i load my phpinfo page to test it all i get is a blank browser window with a '>' in the top left corner and if i go to view source i get '<?php phpinfo() ?>>

    I can't see anything in the error logs either
  6. falko

    falko Super Moderator ISPConfig Developer

    Can you post the URL of your phpinfo page? And also its document root (e.g. /var/www/web1/web)?
  7. Berry

    Berry New Member

    Hi @ all!

    Unfortunately, I have the same problem!

    I have perfect Debian Sarge & ISPConfig 2.2.8, have run PHP as Apache2 module, and now disabled "php4 module" and just exactly followed the HOW-TO, and installed both (php4 and php5). The only difference is that I installed the newest version of suphp (0.6.2)...
    - suphp log shows nothing
    - apache2 log and log in /var/www/web5/log also nothing
    - SuExec is ON in ISPConfig, maybe this is problem?
    - what permissions should be on the php files (now 644)? And what for folders (755)?

    URL =

    Vhost entry is as follows:
    <VirtualHost Xx.Xx.Xx.Xx:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/web5/web
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.jsp Defau$
    ScriptAlias  /cgi-bin/ /var/www/web5/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /var/www/web5/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    suPHP_Engine on
    suPHP_UserGroup tech5_admin web5
    AddHandler x-httpd-php .php .php3 .php4 .php5
    suPHP_AddHandler x-httpd-php
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    AddType application/vnd.wap.wmlscriptc .wmlsc .wsc
    AddType text/vnd.wap.wml .wml
    AddType text/vnd.wap.wmlscript .ws .wmlscript
    AddType image/vnd.wap.wbmp .wbmp
    Alias /error/ "/var/www/web5/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /var/www/web5/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web5/user/$1/web/$3
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Please disable SuEXEC in ISPConfig. SuExec and SuPHP shall not be used together. SuPHP can also run other CGI scripts.
  9. Berry

    Berry New Member

    Yes, now is SuPHP turned OFF, but still not working, Error 500. You can see it at link in post above...

    Could that be some problem with permissions? I've noticed on other servers that when PHP is apache-module then the permissions have to be more loose than when PHP works as CGI. And too loose permisions result in error 500. Is this set by Apache, and if yes is it modifiable?

    Now I did a php4-cgi -v and here is the output :
    PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php4/20050606/' - cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  Xdebug MUST be loaded as a Zend extension in Unknown on line 0
    PHP 4.4.4-0.dotdeb.3 with Suhosin-Patch 0.9.6 (cgi-fcgi) (built: Nov 16 2006 11:18:39)
    The same result is when I do php4 -v.

    I searched the forum for problem, and found this topic -

    I removed and then installed again the php4-ming package and now this is OK!

    EDIT2 :
    I have tried a2enmod mod_suphp and recieved :
    This module does not exist!
    apache2 -v :
    Server version: Apache/2.0.54
    Server built:   Jul 28 2006 09:04:55
    - How to move from this apache2 (perfect debian) to new recompiled one with mod_suphp??
    - Do I have to uninstall something (like PHP4) as PHP run before as a module?
    Last edited: Nov 27, 2006
  10. Berry

    Berry New Member

    Edit 3:
    In log /var/www/web5/log/error.log I have found this :
    [Mon Nov 27 13:55:21 2006] [error] [client] ParsingException in IniFile.cpp:130: Illegal line "[handlers] ;Handler for php-scripts"
    [Mon Nov 27 13:55:21 2006] [error] [client] Premature end of script headers: phpinfo.php
    And on :
    now I'm not certain what, from where and where to I should copy. I purged php4-cli, is this OK ?
    Last edited: Nov 27, 2006
  11. Berry

    Berry New Member

  12. Berry

    Berry New Member

    Problem solved !

    - deleted all php4 and php5 packages
    - installed only php4-cgi and php5-cgi packages
    - recompiled suphp following mentioned how-to
    - I found that phpinfo.php file was 664 instead of 644, changed permission and it works now!

    Now there is also one other problem left for me :
    - In proFTPd config file Umask is correct (022), but files get perm. 664 upon FTP upload. Where to set Umask for files uploaded by FTP?
    Last edited: Nov 29, 2006
  13. falko

    falko Super Moderator ISPConfig Developer

    What's in /etc/proftpd.conf?
  14. Berry

    Berry New Member

    Here, I've attached the file ...

    I also corrected Umask in suPHP.conf file, from 077 to 022, because my files were chmoded to 600 and folders to 700, and this doesn't work with J! and other systems...

    Attached Files:

  15. falko

    falko Super Moderator ISPConfig Developer

    And what's in /etc/proftpd_ispconfig.conf (please post it here directly instead of attaching it)?
  16. Berry

    Berry New Member

    Sorry, I tought it will save space ...

    here is /etc/proftpd_ispconfig.conf
    <VirtualHost XX.XXX.XX.XXX>
            DefaultRoot             ~
            AllowOverwrite          on
            Umask                   002
            <Anonymous /var/www/web3/ftp>
              User                          web3_anonftp
              Group                         web3_anonftp
              UserAlias                     anonymous web3_anonftp
              UserAlias                     guest web3_anonftp
              MaxClients                    10
              <Directory *>
                <Limit WRITE>
              <Directory /var/www/web3/ftp/incoming>
                Umask                       002
                <Limit STOR>
                <Limit READ>
    As I see, here is Umask realy set to 002 instead of 022. I can change it here,but as I supose, ISPC. ads entries here and future FTP accounts will again have 002. Where to set this up so it get's set to 022 automaticaly??
    Last edited: Nov 29, 2006
  17. falko

    falko Super Moderator ISPConfig Developer

    You can change it in /root/ispconfig/isp/conf/proftpd_ispconfig.conf.master.
  18. Berry

    Berry New Member

    DONE! Thanks alot Falko for all the help and fast replies!!! :D

Share This Page