Tag Archives: php

Enable PHP errors while being executed

PHP errors. 

This one is mostly for copy paste purpose. A quick way for myself to find it and include it while programming ;P

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

This is a simple and quick way of viewing errors without having to change the php.ini configuration file.

You must keep in mind though that this won’t show errors due to syntactically incorrect scripts (the parser errors). This is because PHP uses the Zend parser which is executed before the script itself, so since these ini settings has not yet been executed, parse errors won’t be displayed (but logged).
To have them displayed too then you are forced to set the display_errors and error_reporting parameters in the php.ini file.