tags:

views:

64

answers:

7

My webpage is putting out a 500 Internal Server Error. I've turned on E_ALL for error reporting in the php.ini, and restarted the httpd. I've even used error_reporting(E_ALL) and error_reporting(-1) but still no luck. Any suggestions?

OS: CentOS5.5
PHP: 5.2.6
HTTPD:  Apache/2.2.3
A: 

Have you looked in the server log? What web server are you running? What OS are you on?

Andy Lester
Sec I'll edit OP
Rob
A: 

Check for error_log in your document root, and/or ask your server's support team where errors are logged (both Apache and PHP).

alex
Can't find the error log. I have access to root, how would I find out the locations?
Rob
+1  A: 

a 500 Internal Server Error is usually caused by a problem in your Apache config files. It usually doesn't have anything to do with your actual PHP script. For example your .htaccess file. Check your server logs, and if you can, post the errors listed there here as part of your question so we can better assess what your exact problem might be.

jordanstephens
Actually, PHP will output an internal server error if error reporting is off.
Rob
I've never seen or heard of that happening...
jordanstephens
A: 

Check the display_errors directive in your php.ini file. It may be set to 'Off' which will disable ALL error reporting.

Sean Madden
display_errors = on
Rob
A: 

The following testscript also won't generate any error messages/logs.

<?php
header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error');
echo 'Something went gaga';
?>

However the access_log will show the "500" response code (assuming apache's default access_log settings).

Search the code for "HTTP/1.1 500", "500" or "header(" and add:

trigger_error('Peep', E_USER_NOTICE);  // or error_log()

This will generate an entry in the errorlog (with filename and line-numbers)

Bob Fanger
A: 

CentOS you say... your error log is probably in /var/log/httpd/

Try tail -f /var/log/httpd/error_log in the command line and check for any errors

Manos Dilaverakis
Nothing related to the script or PHP.
Rob
A: 

Put this on top of your script:

ini_set('display_errors', true);
error_reporting(E_ALL);
Sarfraz
Yep, didn't work.
Rob