In many cases, our PHP files will appear some very difficult to troubleshoot the error, such as the output of Great white page, tuning the wrong. It is possible that PHP's error level masks some non-fatal errors, causing 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 they can cause large problems (such as the use of undefined variables).
Displays all errors in addition to reminders and coding standardization warnings.
Error reporting is a bit field. You can add numbers together to get the error reporting level you want.
E_all-All errors and warnings (excluding e_strict)
E_error-Fatal Run-time Error
E_warning-Runtime Warning (non-fatal error)
E_parse-Compile-time parse error
E_notice-Run-time Reminders (these are often caused by bugs in your code, or intentional behavior). )
E_STRICT-coding standardization 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 startup (non-fatal error)
E_compile_error-Compile-time fatal error
E_compile_warning-compile-time warnings (non-fatal errors)
E_user_error-user-defined error messages
e_user_warning-user-defined warning messages
E_user_notice-User-Customized reminder message
If set to: E_all e_strict, all error messages are logged, which can cause a large number of error codes to appear on the Web site, but it is a good thing for programmers to optimize the code to the best; some non-fatal errors do not affect the operation of the program, But it can add to the burden of PHP, which typically adds to the burden of Web site processes, such as the IIS application pool.
Adjust error Reporting in PHP
Once you have 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 standalone script to report or ignore different error levels. Table 7-1 lists most of the levels, but they are generally one of the following 3 class levels:
L Note (notice), which does not prevent script execution and may not necessarily be a problem;
L Warning (warning), which indicates a problem, but does not prevent script execution;
L errors (Error), which prevents the script from continuing (including common parsing errors that fundamentally prevent the script from running).
The table 7-1 the error reporting settings for PHP, used with the error_reporting () function, or used in php.ini files. Note that the value of E_all is different from the old version of PHP and does not include e_strict (but exists in PHP 6)
Number |
constant |
Report |
1 |
E_error |
Fatal Run-time Error (it prevents script execution) |
2 |
E_warning |
Runtime Warning (not fatal error) |
4 |
E_parse |
Parse error |
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 warnings, generated by the Trigger_error () function |
1024 |
E_user_notice |
User generated attention, generated by the Trigger_error () function |
2048 |
E_strict |
Recommendations for compatibility and interoperability |
8191 |
E_all |
All errors, warnings, and suggestions |