View Full Version : suPHP 500 Internal Server Error
mattbrown
22nd August 2006, 14:22
Hi
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?
----edit
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
</Location>
And my phpinfo.php reports
CGI/Fastcgi
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
------
mattbrown
22nd August 2006, 17:20
Hi
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
rw-rw-r--
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
Matt
till
23rd August 2006, 12:04
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.
mattbrown
23rd August 2006, 21:32
Ok
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
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false
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??
~matt~
mattbrown
23rd August 2006, 23:39
ok
I found this
http://dries.ulyssis.org/rpm/packages/mod_suphp/info.html
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
falko
24th August 2006, 18:17
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() ?>>
Can you post the URL of your phpinfo page? And also its document root (e.g. /var/www/web1/web)?
Berry
24th November 2006, 17:39
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 http://www.howtoforge.com/apache2_suphp_php4_php5, 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 = www.varazdinec.net/test/phpinfo.php
Vhost entry is as follows:
<VirtualHost Xx.Xx.Xx.Xx:80>
ServerName www.varazdinec.net:80
ServerAdmin webmaster@varazdinec.net
DocumentRoot /var/www/web5/web
ServerAlias varazdinec.net
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl 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
</VirtualHost>
till
24th November 2006, 18:47
Please disable SuEXEC in ISPConfig. SuExec and SuPHP shall not be used together. SuPHP can also run other CGI scripts.
Berry
27th November 2006, 12:17
Please disable SuEXEC in ISPConfig. SuExec and SuPHP shall not be used together. SuPHP can also run other CGI scripts.
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?
EDIT:
Now I did a php4-cgi -v and here is the output :
PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/20050606/ming.so' - libming.so: 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 ming.so problem, and found this topic - http://www.howtoforge.com/forums/showthread.php?t=3328
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?
Berry
27th November 2006, 15:44
Edit 3:
In log /var/www/web5/log/error.log I have found this :
[Mon Nov 27 13:55:21 2006] [error] [client 83.131.4.223] ParsingException in IniFile.cpp:130: Illegal line "[handlers] ;Handler for php-scripts"
[Mon Nov 27 13:55:21 2006] [error] [client 83.131.4.223] Premature end of script headers: phpinfo.php
And on http://www.suphp.org/FAQ.html :
Why do my scripts not work and why do I get an "Premature end of script headers" in the error_log?
You probably have installed the CLI version of PHP, but you need the CGI version. Copy the file /build/path/sapi/cgi/php to /where/ever/you/have/installed/bin/php to use the CGI version.
now I'm not certain what, from where and where to I should copy. I purged php4-cli, is this OK ?
Berry
27th November 2006, 19:19
EDIT #4:
I've found also this references :
http://lists.marsching.biz/pipermail/suphp/2004-January/000179.html
http://lists.marsching.biz/pipermail/suphp/2004-January/000182.html
Should I recompile suPHP with explicit path to php4-cgi or it would then disable php4-cgi support?
Berry
28th November 2006, 13:44
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?
falko
28th November 2006, 16:18
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?
What's in /etc/proftpd.conf?
Berry
28th November 2006, 17:51
What's in /etc/proftpd.conf?
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...
falko
29th November 2006, 16:57
And what's in /etc/proftpd_ispconfig.conf (please post it here directly instead of attaching it)?
Berry
29th November 2006, 17:09
And what's in /etc/proftpd_ispconfig.conf (please post it here directly instead of attaching it)?
Sorry, I tought it will save space ...
here is /etc/proftpd_ispconfig.conf
DefaultAddress 127.0.0.1
<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>
DenyAll
</Limit>
</Directory>
<Directory /var/www/web3/ftp/incoming>
Umask 002
<Limit STOR>
AllowAll
</Limit>
<Limit READ>
DenyAll
</Limit>
</Directory>
</Anonymous>
</VirtualHost>
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??
falko
29th November 2006, 17:16
Where to set this up so it get's set to 022 automaticaly??
You can change it in /root/ispconfig/isp/conf/proftpd_ispconfig.conf.master.
Berry
29th November 2006, 17:23
You can change it in /root/ispconfig/isp/conf/proftpd_ispconfig.conf.master.
DONE! Thanks alot Falko for all the help and fast replies!!! :D
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.