Get the App
SLTechnology News&Howtos  ›  Development  › 

Tutorial on how to configure masking error messages to display and save error logs in PHP.ini

Shulou Source: shulou.com Published: 2022-06-03 08:11:05 10月01日 Update

This article mainly explains the "PHP.ini configuration masking error message display and save error log method tutorial", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "PHP.ini configuration masking error message display and save error log method tutorial"!

If there is an error during the running of the PHP program, whether the error message is displayed on the browser and the level of the error message is what we need to control in the process of program development, debugging and operation.

The following instructions are given to control the shielding and display of PHP error messages (errors) by setting php.ini:

1. Whether the error message is displayed

The copy code is as follows:

Display error display_errors = On

Masking error display_errors = Off (default)

2. The level at which error messages are displayed

The copy code is as follows:

Error_reporting = E_ALL (all)

Error_reporting = E_ALL & ~ E_NOTICE (errors above Notice 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 are generally set not to display errors, so that the running status can be recorded by saving the error log.

The copy code is as follows:

Log_errors = On (record error log)

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 copy code is as follows:

Error_log = e:/php/logs/php_error.log

Thank you for your reading, the above is the content of "configuring masking error message display and saving error log method tutorial in PHP.ini". After the study of this article, I believe you have a deeper understanding of the problem of configuring masking error message display and saving error log method tutorial in PHP.ini, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Errors information logs code programs tutorials methods configurations levels processes learning content control operations operations functions can be passed at the same time that is ideas Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft OPPO Reno Shulou Information vpn Linux