The following script is not outputting error messages to the browser. Instead it results in an HTTP Error 500 response.
下面的脚本没有向浏览器输出错误消息。相反,它会导致HTTP错误500响应。
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
phpinfo();
echo "test" asdf // This should error
?>
Ideas? This is a basic php5/apache2 install on ubuntu. httpd.conf is blank, no .htaccess file.
想法吗?这是一个基本的php5/apache2安装在ubuntu上。httpd。conf为空,没有.htaccess文件。
The error.log file displays the error message:
这个错误。日志文件显示错误消息:
syntax error, unexpected T_STRING, expecting ',' or ';'
语法错误,意外的T_STRING,期望','或';'
which is correct.
这是正确的。
1 个解决方案
#1
3
<?php
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
phpinfo();
echo "test" asdf // This should error
?>
In error_reporting
-1
shows even more than E_ALL
and for display_errors
I used the value 1
instead of On
.
在error_reporting -1中显示的甚至比E_ALL还要多,对于display_errors,我使用值1而不是On。
http://php.net/manual/en/function.error-reporting.php http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors
http://php.net/manual/en/function.error-reporting.php http://www.php.net/manual/en/errorfunc.configuration.php ini.display-errors
Edit: I got the answer!
编辑:我知道答案了!
If the script has a parse error that prevents it from running, this also prevents it from > changing a PHP setting.
如果脚本有一个解析错误阻止它运行,这也阻止它修改PHP设置。
https://serverfault.com/questions/242662/ubuntu php5 -输入-显示- 500 -错误-相反的错误消息
#1
3
<?php
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
phpinfo();
echo "test" asdf // This should error
?>
In error_reporting
-1
shows even more than E_ALL
and for display_errors
I used the value 1
instead of On
.
在error_reporting -1中显示的甚至比E_ALL还要多,对于display_errors,我使用值1而不是On。
http://php.net/manual/en/function.error-reporting.php http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors
http://php.net/manual/en/function.error-reporting.php http://www.php.net/manual/en/errorfunc.configuration.php ini.display-errors
Edit: I got the answer!
编辑:我知道答案了!
If the script has a parse error that prevents it from running, this also prevents it from > changing a PHP setting.
如果脚本有一个解析错误阻止它运行,这也阻止它修改PHP设置。
https://serverfault.com/questions/242662/ubuntu php5 -输入-显示- 500 -错误-相反的错误消息