PHP Security-error report

Source: Internet
Author: User
The error reporting function of PHP will help you identify and locate errors. These detailed descriptions provided by PHP may also be seen by malicious attackers. Make the public unable to see the error message...


Error Report

No developer will make mistakes. PHP's error reporting function will help you confirm and locate these errors. These detailed descriptions provided by PHP may also be seen by malicious attackers. It is important that the public cannot see the error message. To do this, you only need to disable display_errors. if you want error information, you can enable the log_errors option and set the saving path of the error log file in the error_log option.

Some errors cannot be found due to the level setting of the error report. you must set error_reporting to E_ALL (E_ALL | E_STRICT is the highest setting and provide downward compatible suggestions, if not recommended ).

All error reporting levels can be modified at any level. Therefore, if you are using a shared host, you are not authorized to access php. ini, httpd. conf, or. when changing configuration files such as htaccess, you can run the error report-level configuration statement in the program:

CODE:

 
 


Tips

# The configuration of php. ini options is described in detail.

PHP also allows you to use the set_error_handler () function to specify your own error handling function:

CODE:

 
 

The above program specifies your own error handling function my_error_handler (); the following is an actual example:

CODE:

 
 

Tips

PHP 5 also allows the second parameter to be passed to set_error_handler () to limit the execution of the defined error handling function in case of any error. For example, you can create a function to handle warnings:

CODE:

 
 

The above is the PHP Security-error report content. For more information, see The PHP Chinese website (www.php1.cn )!

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.