Bug #332
Error 500 While Trying to Access Any Web Service
Description
I encountered an error while trying to access one of the web services provided. I recently did an upgrade of the servers, so I suspect that caused the problems. First, I checked to see if the error was affecting any other web sites, to find that all the web sites had been returning error 500; a server side error. So I checked the log file for the web site to see the following error:
tail /var/www/path/to/web/logfile
[Mon Feb 10 07:12:12 2014] [warn] [client 192.168.0.80] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Mon Feb 10 07:12:12 2014] [error] [client 192.168.0.80] Premature end of script headers: index.php
I then checked the apache log file, to see it had an error:
tail /var/log/apache2/error.log
[2014-02-10 07:17:06]: uid: (1002/user1) gid: (1003/group1) cmd: .php-fcgi-starter
[2014-02-10 07:17:06]: file is writable by others: (/var/www/php-fcgi-scripts/user1/.php-fcgi-starter)
I then checked the permissions of the FastCGI starter script
ls -la /var/www/php-fcgi-scripts/user1/.php-fcgi-starter
rw-rw-r-1 user1 group1 890 Feb 7 17:08 .php-fcgi-starter
Fix this by removing the group writeable permission from the FCGI starter script:
chmod g-w /var/www/php-fcgi-scripts/user1/.php-fcgi-starter
I tested to see if the web site came back, only to get another error 500. I checked the apache2 logfile again to see a different error:
tail /var/log/apache2/error.log
[2014-02-10 07:27:21]: uid: (1002/user1) gid: (1003/group1) cmd: .php-fcgi-starter
[2014-02-10 07:27:21]: file has no execute permission: (/var/www/php-fcgi-scripts/user1/.php-fcgi-starter)
Fix this by adding user execution permissions to the FastCGI script:
chmod 740 /var/www/php-fcgi-scripts/user1/.php-fcgi-starter
This fixed the problem.