Jun 26, 2009

Turn ON error reporting for DEBUGing

PHP usually hides many of the compiler warnings and errors.
Use the following to display errors while debuging your application:


error_reporting(E_ALL);

OR:

ini_set('error_reporting', E_ALL);


More advanced users may want to display only some of the errors.
Such as:

error_reporting(E_ALL ^ E_NOTICE);

To avoid showing notices for uninitiallized variables.

Some more options to experiment with:
E_ERROR
E_WARNING
E_PARSE
E_NOTICE
E_CORE_ERROR
E_CORE_WARNING
E_COMPILE_ERROR
E_COMPILE_WARNING
E_USER_ERROR
E_USER_WARNING
E_USER_NOTICE
E_ALL
E_STRICT
E_RECOVERABLE_ERROR
E_DEPRECATED
E_USER_DEPRECATED

No comments:

Post a Comment