简体   繁体   English

Ubuntu PHP5 / Apache2 - 显示500错误而不是错误消息

[英]Ubuntu PHP5/Apache2 - Displaying 500 error instead of error message

The following script is not outputting error messages to the browser. 以下脚本未向浏览器输出错误消息。 Instead it results in an HTTP Error 500 response. 相反,它会导致HTTP Error 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. 这是ubuntu上基本的php5 / apache2安装。 httpd.conf is blank, no .htaccess file. httpd.conf是空白的,没有.htaccess文件。

The error.log file displays the error message: error.log文件显示错误消息:

syntax error, unexpected T_STRING, expecting ',' or ';' 语法错误,意外的T_STRING,期待','或';'

which is correct. 哪个是对的。

<?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-apache2-displaying-500-error-instead-of-error-message https://serverfault.com/questions/242662/ubuntu-php5-apache2-displaying-500-error-instead-of-error-message

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM