Phpdisplay_errors and log_errors_PHP tutorial

Source: Internet
Author: User
Phpdisplay_errors and log_errors. This article summarizes the usage of phpdisplay_errors and log_errors. For more information, see this article. Display_errors error Echo, which is commonly used in development mode. However, this article summarizes the usage of php display_errors and log_errors. For more information, see this article.

Display_errors

Error Echo, which is commonly used in development mode. However, many applications forget to disable this option in the formal environment. Error Echo can expose a large amount of sensitive information to facilitate the next attack. Disable this option.

Display_errors = On

If an error occurs in the Enabled status, an error is returned.

Dispaly_errors = Off

If an error occurs, the system prompts "Server Error. But no error message appears.

You can define the switch in the program.

// Ini_set ("display_errors", "On"); // display all error messages */
Ini_set ("display_errors", "Off"); // block all error messages

It should be noted that, in the server configuration file, notice errors are blocked and only error errors are displayed. if so, you can enable the error display without displaying notice errors.

Log_errors

Use this in the official environment and record the error information in the log. You can disable error echo.


Set whether to record the error information of script running to the server error log or error_log. Note that this is a specific configuration item related to the server.

Note:

In the production system, it is strongly recommended that you use error logs to record the error information displayed on the web site.


Log_errors_max_len integer
Set the maximum number of bytes for log_errors. the error source information is added to error_log. The default value is 1024. if it is set to 0, the length is not limited. This length is set to the error of the record, the error displayed, and $ php_errormsg will be used for limited production.

When integer is used, the value is measured in bytes. You can also use the stenographer described in the FAQ.

Display_errors and log_errors usage introduction. For more information, see this article. Display_errors error echo, usually used in development mode, but very...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.