PHP Error Reporting

To turn on Error Reporting in PHP, this is what I use. You can set this anywhere in your PHP code, but it has to be above the error or else it will not work. This is the easiest way and will work in most hosting environments:

ini_set(‘display_errors’,1);
error_reporting(E_ALL|E_STRICT);

or if you only want to see Warning Messages and not Notice Messages:

ini_set(‘display_errors’,1);
error_reporting(E_ALL);

and if you just want all Error Reporting off, simply use this:

error_reporting(0);

About this entry