6

The following script is not outputting error messages to the browser. Instead it results in 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 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.

3
  • Does this give you any more errors ini_set(‘display_startup_errors’, ‘On’);? Commented Mar 10, 2011 at 5:09
  • delete the error.log file and run it again. I suspect your php install isn't working..... if it is then the error.log file will be regenerated. the fact that your httpd.conf file is blank could be an issue too Commented Mar 10, 2011 at 5:45
  • Did you figure this out? I have the same problem now, any and all PHP errors cause 500 internal server error. Commented Feb 1, 2013 at 3:31

1 Answer 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.

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

Sign up to request clarification or add additional context in comments.

3 Comments

I'm still getting the same result.
if the script doesn't run, the php.ini changes do not get commited... see edit
Ok, I understand now... Looks like the solution is to just turn on errors via the ini file then. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.