PHP Error Level Collection _php Tutorial

Source: Internet
Author: User
Tags add numbers parse error php error php error reporting
In many cases, our PHP files will have some very difficult to troubleshoot errors, such as the output of large white pages, wrong debugging. It is possible that the error level of PHP masked some non-fatal errors, resulting in no error prompts. So understanding and familiarity with PHP error levels may be a new way to debug.
Error reporting level in php.ini by default, the PHP error reporting level is E_notice, and E_all indicates that all non-fatal errors are reported because these errors can cause large problems (such as using undefined variables).

Displays all errors except reminders and coding normalization warnings.

Error reporting is a bit field. You can add numbers together to get the level of error reporting you want.

E_all-All errors and warnings (not including e_strict)

E_error-Fatal Run-time error

E_warning-run-time warning (non-fatal error)

E_parse-Compile-time parse error

E_notice-Runtime Reminders (these are often caused by bugs in your code, or by intentional behavior.) )

E_strict-coding normalization warning, which allows PHP to suggest how to modify the code to ensure optimal interoperability forward compatibility.

E_core_error-php fatal error during initialization during startup

E_core_warning-php warnings during initialization during startup (non-fatal error)

E_compile_error-Compile-time fatal error

E_compile_warning-Compile-time warning (non-fatal error)

E_user_error-user-defined error message

e_user_warning-user-defined warning message

E_user_notice-User-definable reminder message

If set to: E_all | E_strict, it means that all error messages are logged, which can cause a lot of error codes on the Web site, but it should be a good thing for programmers to optimize the code to the best, while some non-fatal errors do not affect the operation of the program, but will make the burden of PHP heavier, This is typically an increase in the burden of Web site processes, such as the application pool for IIS.
Adjust error Reporting in PHP
Once you've set up PHP to show which errors have occurred, you may want to adjust the level of error reporting. You can set up a PHP installation as a whole or stand-alone script to report or ignore different levels of error. Table 7-1 lists most of the levels, but they are generally one of the following 3 class levels:
Note (notice), which does not prevent the execution of the script, and may not necessarily be a problem;
L Warning (warning), which indicates a problem, but does not prevent the execution of the script;
L error, which prevents the script from continuing to execute (including common parsing errors, which fundamentally prevents the script from running).
Table 7-1 PHP's error reporting settings, used with the error_reporting () function, or in php.ini files. Note that the value of E_all differs from the previous version of PHP and does not include e_strict (but exists in PHP 6)
Id constant Report
1 E_error Fatal Run-time error (it prevents execution of the script)
2 E_warning Run-time warning (non-fatal error)
Continued
Id constant Report
4 E_parse Parsing errors
8 E_notice Note (things may or may not be a problem)
256 E_user_error User-generated error message, generated by the Trigger_error () function
512 E_user_warning User generated warning, generated by the Trigger_error () function
1024 E_user_notice User generated note, generated by the Trigger_error () function
2048 E_strict Recommendations for compatibility and interoperability
8191 E_all All errors, warnings, and suggestions

http://www.bkjia.com/PHPjc/477861.html www.bkjia.com true http://www.bkjia.com/PHPjc/477861.html techarticle In many cases, our PHP files will have some very difficult to troubleshoot errors, such as the output of large white pages, wrong debugging. It is possible that the error level of PHP is masked by some non-fatal ...

  • 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.