Error reporting in PHP run on IIS

The PHP error reporting is controlled either by the php.ini file as a global setting or programatically, or using .htaccess.

The error reporting in php.ini is defined in "Error handling and logging" section.
  • error_reporting = E_ALL & ~E_NOTICE - shows all errors except E_NOTICE errors. E_NOTICE are possible errors which can occur even during normal program workflow - something like Microsoft's warnings.
  • display_errors = On
  • display_startup_errors = On
Programmatically the same settings are applied for current site like this:
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
error_reporting(E_ALL & ~E_NOTICE);

In .htaccess the flags must be changed in the following way:
php_flag display_errors 1
php_flag display_startup_errors 1


Php error_reproting help -> http://php.net/error_reporting

No comments:

Post a Comment