Ubuntu PHP5 / Apache2 - displaying 500 error instead of error message

The following script does not display error messages in the browser. Instead, it triggers an HTTP Error 500 response.

<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); phpinfo(); echo "test" asdf // This should error ?> 

Ideas? This is a basic php5 / apache2 installation on ubuntu. httpd.conf is empty, no .htaccess.

An error message is displayed in the error.log file:

syntax error, unexpected T_STRING, pending ',' or ';'

what is right.

+6
php apache2
source share
1 answer
 <?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 displayed 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 a response!

If the script has a parsing error that prevents it from running, it also prevents it from changing PHP settings.

https://serverfault.com/questions/242662/ubuntu-php5-apache2-displaying-500-error-instead-of-error-message

+3
source share

All Articles