以下脚本未向浏览器输出错误消息.相反,它会导致HTTP Error 500响应.
<?PHP error_reporting(E_ALL); ini_set('display_errors','On'); PHPinfo(); echo "test" asdf // This should error ?>@H_403_3@想法?这是ubuntu上基本的PHP5 / apache2安装. httpd.conf是空白的,没有.htaccess文件. @H_403_3@error.log文件显示错误消息:
@H_403_3@Syntax error,unexpected T_STRING,expecting ‘,’ or ‘;’@H_403_3@哪个是对的.
<?PHP error_reporting(-1); ini_set('display_errors',1); ini_set('display_startup_errors',1); PHPinfo(); echo "test" asdf // This should error ?>@H_403_3@在error_reporting -1中显示甚至超过E_ALL,对于display_errors,我使用值1而不是On. @H_403_3@http://php.net/manual/en/function.error-reporting.php
http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors @H_403_3@编辑:我得到了答案!
@H_403_3@If the script has a parse error that prevents it from running,this also prevents it from > changing a PHP setting.@H_403_3@https://serverfault.com/questions/242662/ubuntu-php5-apache2-displaying-500-error-instead-of-error-message