In PHP learning Display_errors and error_reporting are two very important parameters, in the program debugging process is not enough, the following to explain how these two error log configuration to open and close:
We know that in the production environment of the product must not be able to display errors, so:
Change display_errors = on to display_errors = Off in php.ini
or Ini_set (' display_errors ', 0);
Second, we know that PHP's error level is controlled by error_reporting, but there are a lot of people in the production environment that shut down the error message hint, like this error_reporting (0);
Error_reporting (0) This causes all error messages to not be logged, should: error_reporting = E_all & ~e_notice, as long as Display_errors = OFF, the error message will not be displayed on the page, Because the display_errors has a higher priority level.
In particular, it is important to note that:
If php.ini in log_errors= on, according to the official, then must specify the Error_log file, if not specified or the specified file does not have permission to write, then will output to the normal output channel, then also makes the display_errors The specified off fails, and the error message is printed out. The log_errors = off is OK.
In summary, error messages can also be logged in the production environment without displaying the error message:
<? PHP /* * * Record production environment error log * */ error_reporting (e_all); Ini_set (' Display_errors ', 0); Ini_set (' Log_errors ', 1ini_set(' error_log ', ' e:\ '. Date (' y-m-d '). ' _phpddt.com.txt ');
PHP error Log control (Display_errors and error_reporting)