In PHP. ini, configure the example of blocking error information and saving error logs. If an error occurs while the PHP program is running, check whether the error message is displayed in the browser, the error information is displayed in the browser if an error occurs during the PHP program development, debugging, and operation, and the level of error information that we need to control in the process of program development, debugging, and operation.
The following describes how to set php. ini to control the shielding and display of PHP error messages (errors:
1. whether the error message is displayed
The code is as follows:
Error display_errors = On
Blocked error display_errors = Off (default)
2. display error information level
The code is as follows:
Error_reporting = E_ALL (all)
Error_reporting = E_ALL &~ E_NOTICE (errors above Notice will be displayed)
Here we usually set it to E_ALL, and use the error_reporting () function in PHP to set the error information level of the current program.
3. set whether to save the error log.
In the process of program operation, we usually set to do not display errors, so that you can record the running status by saving the error log.
The code is as follows:
Log_errors = On (records error logs)
Log_errors = Off (not recorded)
If you save the error log, you need to set the error log to save the file at the same time.
The code is as follows:
Error_log = e:/php/logs/php_error.log
...