Contact Us

Issues with error reporting

Posted on 29/3/07 by Tim Koschützki

PHP provides a means to adjust your error reporting level. That means you can decide, which types of errors will be displayed to you and your users.

You can either adjust the error reporting level in your php configuration file or you can use the ini_set() - function to adjust the error reporting level.

// don't report any errors

// report runtime errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// report notices as well
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// report all errors except notices
error_reporting(E_ALL ^ E_NOTICE);

// report all php errors

ini_set ('error_reporting', E_ALL);

Which types of errors are there?

  • E_ERROR - Fatal runtime errors. This shows errors, that can't be resolved. Script execution is halted.
  • E_WARNING - Warnings (no fatal errors). Script execution is not halted.
  • E_PARSE - Parse errors (for example, syntax errors) cause a script halt.
  • E_NOTICE - Notifications that may indicate a problem in your source code. Script execution is not halted. However, if notices aren't intended you should fix the corresponding problem. Also make sure you do not display notices to your visitors, because that may encourage them to hack your site.
  • E_CORE_ERROR - Errors that are caused when PHP is starting. These are like E_ERROR with the only difference that they are not caused by a script, but by the PHP core.
  • E_CORE_WARNING - Warnings from the PHP Core. They are like E_WARNING.
  • E_COMPILE_ERROR - Errors that are caused by the Zend Engine during compilation of PHP.
  • E_COMPILE_WARNING - Warnings caused by the Zend Engine during compilation of PHP.
  • E_USER_ERROR - These are like E_ERROR with the difference that they are deliberately caused in the script through the usage of trigger_error().
  • E_USER_WARNING - Warnings caused by trigger_error() in the script.
  • E_USER_NOTICE - Notices caused by trigger_error() in the script when something unexpected happens.
  • E_ALL - Displays all errors of all error levels, except E_STRICT.
  • E_STRICT - Notices by the run time system. They make you aware of possible code changes you should make to maintain interoperability.


You can skip to the end and add a comment.

This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.