How do I get PHP errors to display?

I have checked my PHP init file ( php.ini ) and display errors is set and also error reporting is E_ALL . I have restarted my Apache web server.

I have even put these lines at the top of my script, and it doesn’t even catch simple parse errors. For example, I declare variables with a "$" and I don’t close statements ";" . But all my scripts show a blank page on these errors, but I want to actually see the errors in my browser output.

error_reporting(E_ALL);
ini_set('display_errors', 1);

What is left to do?

1 Like

This always works for me:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

However, this doesn’t make PHP to show parse errors - the only way to show those errors is to modify your php.ini with this line:

display_errors = on

Refer: https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display