PHP has a configuration directive intended exactly for that, called display_errors
. Like any other configuration setting, it’s best to be set in php.ini
. But in case you don’t have access to this file, you can set it right in PHP code
to Hide All Errors:
ini_set('display_errors', 0);
to Show All Errors:
ini_set('display_errors', 1);
While ERROR_REPORTING
value, which is often mistakenly taken responsible for hiding errors, should be kept at E_ALL
all the time, so errors could be logged on the server.