PDA

View Full Version : suPHP problem, consistent 500 error



ginkelb
03-24-2009, 09:26 AM
Hi there,

Installed a DirectAdmin server a fresh with the CustomBuild script. However all loaded PHP files return a "500 internal server error".

Have tried the read/followed these guide lines to the letter (for a far as they apply):

HOWTO: PHP 5 CLI to PHP 5 CGI + suPHP
http://www.directadmin.com/forum/showthread.php?t=29483&highlight=suPHP+webmail

Allow php scripts to work under ~username when using suPhp (custombuild)
http://help.directadmin.com/item.php?id=176


I have been around the web looking for anwers but still haven't found them.

Can someone point my nose in the right direction?

Thanks a bunch,
Bas van Ginkel
the Netherlands



-----THINGS I'VE CHECKED-----
- File permissions
- Directory permissions
- httpd.conf




-----SUPHP.LOG-----

[Tue Mar 24 16:43:07 2009] [warn] Directory "/" is writeable by group
[Tue Mar 24 16:43:08 2009] [warn] Directory "/" is writeable by group
[Tue Mar 24 16:48:17 2009] [warn] Directory "/" is writeable by group
[Tue Mar 24 16:48:18 2009] [warn] Directory "/" is writeable by group




-----SCREENDUMP OF FILE I TRIED TO ACCESS-----
drwxr-xr-x 21 dskonline dskonline 4096 Mar 24 16:42 public_html <THE DIR CONTAINING THE FILE>
-rw-r--r-- 1 dskonline dskonline 22 Mar 24 16:41 info.php <THE FILE>




-----OPTIONS.CONF-----

#PHP settings. default_php possible values - 4 or 5
default_php=5
php5_cli=no
php5_cgi=yes
php4_cli=no
php4_cgi=no
php_ini=yes
#Possible values - recommended or dist
php_ini_type=recommended
zend=yes

#Possible values - 5.0 or 5.1 (4.1 is possible too, but it's EOL)
mysql=5.0
mysql_inst=yes
mysql_backup=yes

#Possible values - 1.3, 2.0 or 2.2
apache_ver=2.2

#Web applications
phpmyadmin=yes
atmail=yes
squirrelmail=yes
roundcube=yes
uebimiau=yes

#Mail options
mail-header-patch=yes
dovecot=yes
eximconf=yes

#FTP options
proftpd=yes

#Jailed shell
jail=no

#Custombuild options
autover=yes
bold=yes
clean=yes
fileserver=2
custombuild=1.1
awstats=no
webalizer=yes
clean_old_webapps=yes
cron=no
email=email@domain.com
notifications=yes
updates=no
webapps_updates=yes

smtalk
03-24-2009, 09:31 AM
Try:


chown root:root /

ginkelb
03-24-2009, 10:31 AM
Unfortunatly no joy.

Here are some more config files.



-----/etc/httpd/conf/extra/httpd-suphp.conf-----

<IfModule mod_suphp.c>
<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$">
AddHandler x-httpd-php5 .inc .php .php3 .php4 .php5 .phtml
</FilesMatch>
<Location />
suPHP_Engine on
suPHP_ConfigPath /usr/local/etc/php5/cgi/
suPHP_AddHandler x-httpd-php5
</Location>
</IfModule>




-----/usr/local/suphp/etc/suphp.conf-----

[global]
;Path to logfile
logfile=/var/log/suphp.log

;Loglevel
loglevel=warn

;User Apache is running as
webserver_user=apache

;Path all scripts have to be in
docroot=/

; 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=false

;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
x-httpd-php5="php:/usr/local/php5/bin/php-cgi"

;Handler for CGI-scripts
x-suphp-cgi="execute:!self"




-----parts of /etc/httpd/conf/httpd.conf-----

#LoadModule dummy_module /usr/lib/apache/mod_dummy.so
Include /etc/httpd/conf/extra/httpd-phpmodules.conf

User apache
Group apache

ServerAdmin admin@localhost
DocumentRoot "/var/www/html"

....

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
<IfModule mod_suphp.c>
suPHP_Engine On
#suPHP_UserGroup webapps webapps
</IfModule>
</Directory>

....
# All suPHP directives
Include conf/extra/httpd-suphp.conf

# All the other includes needed by the custombuild script
Include conf/extra/httpd-includes.conf

smtalk
03-24-2009, 10:53 AM
chmod 755 /

ginkelb
03-24-2009, 10:59 AM
That seems to solve it!!!

Thanx a bunch,
Bas

shanti
09-22-2009, 04:27 PM
cannot follow your procedure x-D .. is smtalk some freakin bot ? :confused:

Akyhne
09-22-2009, 07:50 PM
I have the exact same 500 error, but the suggestions by smtalk doesn't help me. I can view anything but php files.

scsi
09-23-2009, 06:48 AM
Check the apache error logs to see what the 500 is meaning.

Akyhne
09-23-2009, 08:37 AM
/var/log/httpd/error_log

[Wed Sep 23 12:08:02 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:08:02 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:08:02 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:08:02 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:08:02 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Sep 23 12:08:03 2009] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed Sep 23 12:08:03 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:08:03 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:08:03 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:08:03 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:08:03 2009] [notice] Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8e-fips-rhel5 DAV/2 configured -- resuming normal operations
[Wed Sep 23 12:49:02 2009] [notice] caught SIGTERM, shutting down
[Wed Sep 23 12:55:14 2009] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed Sep 23 12:55:14 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:14 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:14 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:14 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:55:14 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Sep 23 12:55:15 2009] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed Sep 23 12:55:15 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:15 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:15 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:15 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:55:15 2009] [notice] Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8e-fips-rhel5 DAV/2 configured -- resuming normal operations
[Wed Sep 23 12:55:24 2009] [notice] caught SIGTERM, shutting down
[Wed Sep 23 12:55:25 2009] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed Sep 23 12:55:25 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:25 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:25 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:25 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:55:25 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Sep 23 12:55:27 2009] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed Sep 23 12:55:27 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:27 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:27 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:55:27 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:55:27 2009] [notice] Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8e-fips-rhel5 DAV/2 configured -- resuming normal operations
[Wed Sep 23 12:56:01 2009] [notice] caught SIGTERM, shutting down
[Wed Sep 23 12:56:02 2009] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed Sep 23 12:56:02 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:56:02 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:56:02 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:56:02 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:56:02 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Sep 23 12:56:03 2009] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed Sep 23 12:56:03 2009] [warn] Init: SSL server IP/port conflict: www.subdomain.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:176) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:56:03 2009] [warn] Init: SSL server IP/port conflict: www.as.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:109) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:56:03 2009] [warn] Init: SSL server IP/port conflict: www.vami.dk:443 (/usr/local/directadmin/data/users/agk/httpd.conf:43) vs. www.nnn.com:443 (/usr/local/directadmin/data/users/nan/httpd.conf:43)
[Wed Sep 23 12:56:03 2009] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Sep 23 12:56:03 2009] [notice] Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8e-fips-rhel5 DAV/2 configured -- resuming normal operations

Akyhne
09-23-2009, 08:44 AM
/var/log/httpd/error_log

9.96.183.77 - - [20/Sep/2009:05:16:04 +0100] "GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1" 400 469
89.96.183.77 - - [20/Sep/2009:05:16:05 +0100] "GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1" 400 469
85.17.212.24 - - [23/Sep/2009:07:43:24 +0100] "GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1" 400 469
85.17.212.24 - - [23/Sep/2009:07:43:24 +0100] "GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1" 400 469
195.82.167.1 - - [23/Sep/2009:11:47:04 +0100] "GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.0" 404 577
195.82.167.1 - - [23/Sep/2009:11:47:04 +0100] "GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.0" 404 577


/var/log/httpd/suexec_log didn't exist, so I created it manually. There's no errors there.

When I restart httpd, I see the following warnings:
[Wed Sep 23 15:38:04 2009] [warn] NameVirtualHost 2x.xxx.xxx.xxx:80 has no VirtualHosts
[Wed Sep 23 15:38:04 2009] [warn] NameVirtualHost 2x.xxx.xxx.xxx:443 has no VirtualHosts
[Wed Sep 23 15:38:04 2009] [warn] NameVirtualHost 2x.xxx.xxx.xxx:80 has no VirtualHosts
[Wed Sep 23 15:38:04 2009] [warn] NameVirtualHost 2x.xxx.xxx.xxx:443 has no VirtualHosts

scsi
09-23-2009, 09:17 AM
wrong error log you gotta link the one for the domain

Akyhne
09-23-2009, 09:24 AM
Where would I be looking for that?

Akyhne
09-23-2009, 09:31 AM
This error goes again and again, since I installed SuPhp

[Wed Sep 23 16:25:44 2009] [error] [client 66.249.65.35] SoftException in Application.cpp:564: Directory "/home/xxx/domains/yyy.com" is writeable by group
[Wed Sep 23 16:25:44 2009] [error] [client 66.249.65.35] Premature end of script headers: index.php

scsi
09-23-2009, 11:02 AM
directory permission should be 755 not 775.

What are the permissions of that folder?

Akyhne
09-23-2009, 11:04 AM
Permissions are 755.

Strange enough, phpMyadmin works ok.

localhost
09-23-2009, 04:58 PM
Your file permissions are wrong, that's the issue.

Before of all try:

/usr/local/directadmin/scripts/fix_permission.sh all

Akyhne
09-23-2009, 05:02 PM
"No such file or directory"

localhost
09-23-2009, 05:08 PM
Sorry, I typed from my memory...

/usr/local/directadmin/scripts/set_permissions.sh all

If you have a lot of files, It can take several minutes to finish.

Akyhne
09-23-2009, 05:12 PM
Brilliant! It seems to work now :)

Akyhne
09-23-2009, 05:15 PM
Hmm, I just have no ftp access to files anymore. I can view them, just not access them.

Akyhne
09-23-2009, 05:21 PM
... and php files can't access each other with include() or similar.

localhost
09-23-2009, 05:22 PM
What do you mean by "... just not access them.."?
I think you got some really big trouble with the permissions there. You can try to restart your ftp server, also there should be a /tmp/set_permissions.log or something similar try to search there and see if you can find an Error, then post that here.

Akyhne
09-23-2009, 05:31 PM
(I can see the files vis ftp, but I can't do anything, like upload, download, chmod files.)
EDIT: I now have ftp access after restarting.

And my forum can't run as it can't use include();

Warning: require_once(/home/xxx/public_html/Sources/QueryString.php) [function.require-once]: failed to open stream: Permission denied in /home/xxx/public_html/SSI.php on line 62

Akyhne
09-23-2009, 05:39 PM
I chowned the folders in the root to 755. Now that seems to be solved.

Next error is for sessions:
Warning: session_start() [function.session-start]: open(/tmp/sess_5e97bc301849d5f8ae2c7aab52a404b9, O_RDWR) failed: Permission denied (13)

But where is that tmp folder? It's not in my domain.

Akyhne
09-23-2009, 06:44 PM
/tmp/

Seems the old session files were just locked. I deleted them and now sessions work again.

I'm still having 500 errors. Seems it is with all default domains.

Akyhne
09-24-2009, 08:09 PM
For several reasons, I reinstalled everything again, and now I just can't get rid of the Internal 500 error.
/usr/local/directadmin/scripts/set_permissions.sh all doesn't change permissions of files in my public_html folders, but even I chmod and chown files and folders, problems are the same.

scsi
09-25-2009, 07:03 AM
Your going to have to look at your apache error log for the domain to find out what the 500 error is referring to.

Akyhne
09-25-2009, 08:26 AM
I finally got it to work. Last problem is that if I use
$filePath = $_SERVER['DOCUMENT_ROOT']; to see the path of root, I get the right address. But if I try to delete a file like this,

unlink($filePath . '/file.txt'), the file doesn't exist.

ChipW
10-03-2009, 12:24 PM
Waiting for my client to reply back to me to see if this is what I needed, but I did find that I had to restart my mysqld after the script finished running...