Results 1 to 2 of 2
Mar 30, 2012, 17:13 #1
- Join Date
- Nov 2004
- Right behind you, watching, always watching.
- 0 Post(s)
- 0 Thread(s)
PHP Errors causing Apache 500 Internal Server Errors
I am helping a client move her sites to a new server, everything seemed fine until we hit this today.
Basically any PHP fatal error causes a 500 internal error to be shown in the browser, and actually I should say it happens in Chrome, IE but not Firefox (FF shows a white screen).
The server is a brand new box, cpanel, PHP 5.2, Apache etc etc. We have been on the phone with their tech support for hours and their explanation just doesn't make sense.
They are saying that because error_reporting in PHP is turned off that PHP is only sending headers to Apache which is choking on them and throwing the 500.
For example a test file that only contains the following PHP code (error is on purpose):
echo "this is a string with and extra (") in it";
Causes the 500 error
At first we thought is was because they were using suPHP but they switched it to dsoPHP and the same thing is happening.
It should be noted we are logging errors to /var/logs/php_errors and they are logging properly, the Apache logs are NOT showing the 500 errors for some reason.
They have recompiled PHP twice with no change BTW.
I am literally at my wits end. This box MUST be up and running properly no later than Sunday night as it has government websites on it and this error is making us nuts. Any help would be truly appreciated!
Mar 31, 2012, 00:08 #2
- Join Date
- Feb 2002
- 16 Post(s)
- 2 Thread(s)
1. Error check the code on a test server before uploading (but you already new that).
2. Send PHP an error reporting code which should make it only report Fatal errors (your example was a compilation error). That can (SHOULD) be in an autoprepend PHP script.
3. The PHP Anthology book(s) has/have code to handle non-fatal PHP errors.
Actually, I'd recommend that you have a mod move this to the PHP board as there are things you can do within PHP (like #2 above). For me, I believe that the problem MUST be within the PHP ini file, i.e., PHP's not properly configured on the host's system. With the difficulty I had sorting out the Error reporting code when I reloaded on this computer a year ago, I'd better leave that to the experts over in the PHP board.