$ Currency

How to display PHP errors

In this short article we will show you how to enable PHP error output on the screen. This is necessary for debugging script execution and identifying all problems: recommendations, warnings (notices),…

How to display PHP errors

In this short article we will show you how to enable PHP error output on the screen. This is necessary for debugging script execution and identifying all problems: recommendations, warnings (notices), and errors.

To display PHP errors, add the following code at the beginning of the executable script:

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

To enable error display across the entire site, add the following code to the .htaccess file in the site root:

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_value docref_root 1
php_value docref_ext 1

Another way to display PHP error codes is to add the following lines to the php.ini configuration file in the site root:

display_errors = 1;
error_reporting = E_ALL;

Debugging is a mandatory procedure before releasing a script or for fixing bugs, but don't forget to disable error display after debugging is complete, so that users are not inconvenienced by unfamiliar text or code appearing on the page.

Contact via Telegram Contact via Telegram