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.
<?php
error_reporting(E_AL开发者_JAVA技巧L);
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.
The error.log file displays the error message:
syntax error, unexpected T_STRING, expecting ',' or ';'
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
.
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.
https://serverfault.com/questions/242662/ubuntu-php5-apache2-displaying-500-error-instead-of-error-message
精彩评论