开发者

PHP not outputting errors?

My webpage is putting out a 50开发者_如何转开发0 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


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)


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


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.


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


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


Put this on top of your script:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜