Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any simple PHP Parse Error Causes 500 Server Error [closed]

My server (Apache2, PHP5) returns a blank page with Header Code 500 whenever it comes across a simple parse error in PHP. For instance:

<?php functiondoesnotexist(); ?>

or

<?php echo 'with2semicolons';; ?>

Does not output one of those orange tables telling me what's wrong, the server simply bails.

I've checked the Apache error logs and it is indeed telling me the error (for instance Undefined function functiondoesnotexist()).

How can I stop this behaviour? My php.ini is (as far as I know) untouched.

like image 555
Alfo Avatar asked Jul 04 '26 23:07

Alfo


2 Answers

You can set these error variables in your php.ini file:

error_reporting = E_ALL | E_STRICT
display_errors = On

And/or override them at the start of your php scripts when needed:

ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
like image 75
Mark Avatar answered Jul 06 '26 12:07

Mark


Try adding the error reporting and display_errors per ini_set before, e.g.:

<?php 
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); 
ini_set('display_errors', '1')
?>

...

<?php functiondoesnotexist(); ?>
like image 39
scessor Avatar answered Jul 06 '26 13:07

scessor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!