PHP not displaying errors?

My webpage is throwing 500 internal server errors. I enabled E_ALL for error reporting in php.ini and restarted httpd. I've even used error_reporting(E_ALL)

and error_reporting(-1)

, but no luck so far. Any suggestions?

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

      

+2


a source to share


6 answers


500 Internal Server Error is usually caused by a problem in your Apache config files. This usually has nothing to do with your actual PHP script. For example your .htaccess file. Check your server logs, and if you can, post bugs here as part of your question so we can better assess what your exact problem is.



+1


a source


Check error_log

at the root of your document and / or ask your server support team where errors are being logged (both Apache and PHP).



0


a source


Check the directive display_errors

in your php.ini file. It can be set to "Off" which will disable ALL error reporting.

0


a source


The following test script will also not generate error messages / logs.

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

      

However, access_log will display the response code "500" (assuming the default apache access parameters are set).

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

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

      

This will create an entry in the error log (with filename and line numbers)

0


a source


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

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

0


a source


Place this on top of your script:

ini_set('display_errors', true);
error_reporting(E_ALL);

      

0


a source







All Articles