PHP Error Reporting settings

Source: Internet
Author: User
Tags php error php error reporting

PHP gives different error hints for different severity errors at run time.

Development, in order to standardize the program, the error level to higher, notice level of the report, to help quickly locate errors and code specifications. In the product line, the site operation process, it is not appropriate to report so many wrong, 1: This error to the customer's impression is not good; 2: in error, the absolute path of the website is reported, increase the risk of attack, therefore, in the website after the online, should let the error level down, less reported or even not reported.

Setting the error Reporting level

1: Modify error_reporting option in PHP.ini, 2: Can be modified in PHP page, error_reporting () function.

The error level is represented by a value of 2, 1111 1111 1111 111, left to Yes, and 1 on each, representing an error level.

E_error fatal error: 0000 0000 0000 001 Open

E_warning warning error: 0000 0000 0000 010 Open

E_parse syntax error: 0000 0000 0000 100 Open

E_notice warning: 0000 0000 0001 000 Open

E_all all errors: 1111 1111 1111 111 Open

1<?PHP2 Define(' DEBUG ',true);//at development time, declare a debug mode3 if(defined(' DEBUG ')) {4     error_reporting(E_all);//all errors are reported in development mode5}Else {6     error_reporting(0);//after the line, no error7 }8 Echo $a+$b;//Newspaper Notice9 Echo3/0;//Newspaper WarningTen EchoASDF ();//Report fatal error One?>

PHP Error Reporting settings

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.