Phpdisplay_errors and log_errors

Source: Internet
Author: User
This article summarizes the usage of phpdisplay_errors and log_errors. For more information, see this article. 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 non-

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 in the off status, the system prompts: Server Error. but no error prompt 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 close the error echo function.

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 log_errors bytes. 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, its value is measured in bytes. you can also use the stenographer described in the FAQ.

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.