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

This entry was posted in   PHP.
Bookmark the   permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.