1. Home
  2. PHP
  3. Displaying errors on-screen for debugging

Displaying errors on-screen for debugging

Overview

During early development of a PHP application or to debug a problem, errors should be displayed in-browser to help spot typos, undefined variables, misconfiguration, and other logic flaws.

Solution

Enable display_errors and increase verbosity in error_reporting within PHP. As an example, configuration within a .htaccess  would be:

php_flag display_errors On
php_value error_reporting 9999999

Caveats

Some applications may use a separate configuration value to enable/disable debugging. This in turn will toggle the above settings on or off within the application through ini_set. Refer to your application’s manual for specific instructions.

Common Applications

Updated on March 7, 2021

Related Articles