Home > Backend Development > PHP Tutorial > Example of configuring the display of masked error messages and saving error logs in PHP.ini_PHP Tutorial

Example of configuring the display of masked error messages and saving error logs in PHP.ini_PHP Tutorial

WBOY
Release: 2016-07-13 10:29:49
Original
679 people have browsed it

If an error occurs when a PHP program is running, whether the error message is displayed on the browser and the level of the error message are what we need to control during program development, debugging, and operation.
The following explains how to control the shielding and display of PHP error messages (errors) by setting php.ini:
1. Whether error messages are displayed

Copy code The code is as follows:
Display errors display_errors = On
Screen errors display_errors = Off (default value)

2. Display error message level
Copy code The code is as follows:
error_reporting = E_ALL (all)
error_reporting = E_ALL & ~E_NOTICE (Notice above errors will be displayed)

Here we generally set it to E_ALL, and use the error_reporting() function in the PHP program to set the error message level of the current program.
3. Set whether to save the error log
During the operation of the program, we generally set it not to display errors, so that the running status can be recorded by saving the error log
Copy code The code is as follows:
log_errors = On (record error log)
log_errors = Off (do not record)

If you save the error log, you need to set the error log at the same time Save the file
Copy the code The code is as follows:
error_log = e:/php/logs/php_error.log

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/769243.htmlTechArticleIf an error occurs during the running of the PHP program, whether the error message is displayed on the browser, and the error message is displayed The level is what we need in the process of program development, debugging, and operation...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template