How do I get PHP errors to display? How do I get PHP errors to display? php php

How do I get PHP errors to display?


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

(if you don't have access to php.ini, then putting this line in .htaccess might work too):

php_flag display_errors 1


You can't catch parse errors when enabling error output at runtime, because it parses the file before actually executing anything (and since it encounters an error during this, it won't execute anything). You'll need to change the actual server configuration so that display_errors is on and the approriate error_reporting level is used. If you don't have access to php.ini, you may be able to use .htaccess or similar, depending on the server.

This question may provide additional info.


Inside your php.ini:

display_errors = on

Then restart your web server.