Home  »  CodeSnippets   »   How to Configure PHP Display Errors

How to Configure PHP Display Errors

Posted: February 7, 2022 | by Michael Bright

Add these lines at the top of your PHP script file:

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

The above enables the display of PHP errors including startup errors as well as reporting all errors, warnings, and notices.

Configure PHP Display Errors Using .htaccess by adding these lines:

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_value error_log  /home/path/public_html/domain/PHP_errors.log

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.