Error type
Because of the clever setting of the error type integer value, bitwise operators can be used
1 E_ERROR (integer)
Fatal runtime error. This type of error is generally an unrecoverable situation, such as a problem caused by memory allocation.
Causing the script to terminate and no longer continue to run
Example: Calling an undefined function, there is an uncaught exception
2 E_WARNING (integer)
Run-time warning (non-fatal error)
Only a prompt message is given, but the script does not Will terminate the operation.
4 E_PARSE (integer)
Compile time syntax parsing error.
Parse errors are generated only by the parser.
register_shutdown_function cannot capture this error that occurred in this file
8 E_NOTICE (integer)
Runtime notification. Indicates that the script encounters a situation that may appear as an error, but there may also be similar notifications in scripts that can run normally
Example: Using undefined variables
16 E_CORE_ERROR (integer)
During the PHP initialization startup process A fatal error occurred.
This error is similar to E_ERROR, but is generated by the PHP engine core.
32 E_CORE_WARNING (integer)
Warning (non-fatal error) occurred during PHP initialization startup process
Similar to E_WARNING, but generated by the PHP engine core
E_COMPILE_
Compilation related
64 E_COMPILE_ERROR (integer)
Fatal compilation Time error. Similar to E_ERROR, but generated by the Zend script engine. since PHP 4
128 E_COMPILE_WARNING (integer)
Compile time warning (non-fatal error). Similar to E_WARNING, but generated by the Zend scripting engine.
E_USER_
User-generated
256 E_USER_ERROR (integer)
User-generated error message. Similar to E_ERROR, but is generated by the user using the PHP function trigger_error() in the code. since PHP 4
512 E_USER_WARNING (integer)
Warning message generated by the user. Similar to E_WARNING, but is generated by the user using the PHP function trigger_error() in the code. since PHP 4
1024 E_USER_NOTICE (integer)
Notification information generated by the user. Similar to E_NOTICE, but is generated by the user using the PHP function trigger_error() in the code
2048 E_STRICT (integer)
Enables PHP's suggestions for code modifications to ensure the best interoperability and forward progress of the code compatibility.
4096 E_RECOVERABLE_ERROR (integer)
A fatal error that can be caught. It indicates that a potentially dangerous error has occurred, but has not caused the PHP engine to become unstable. If the error is not caught by a user-defined handler (set_error_handler()), it will become an E_ERROR and the script will terminate.
8192 E_DEPRECATED (integer)
Runtime notification.
When enabled, a warning will be given for code that may not work properly in future versions.
16384 E_USER_DEPRECATED (integer)
Warning message generated by the user. Similar to E_DEPRECATED, but is generated by the user using the PHP function trigger_error() in the code.
30719 E_ALL (integer)
E_STRICT All errors and warning letters out of the
Error handling related functions
error_reporting
int error_reporting ([ int $level ] )
Set what kind of PHP errors should be reported
/ / Close all PHP error reporting and return the new error reporting level error_reporting(0); // Report simple running errorserror_reporting(E_ERROR | E_WARNING | E_PARSE);
If no parameters are used, the current error reporting level will be returned
error_get_last
Get the last error that occurred, register_shutdown_function() is often used
array error_get_last (void)
return result
Array(
[type] => 8
[message] => Undefined variable: a [file ] => C:WWWindex.php [line] => 2)
trigger_error
Generate a user-level error/warning/notice message
bool trigger_error ( string $error_msg [, int $error_type = E_USER_NOTICE ]
error_log
Send error information to the error log of the web server, or to a file. If the file does not exist, it will be created
bool error_log ( string $message [, int $message_type = 0 [, string $destination [ , string $extra_headers ]]] )
message_type
Set where errors should be sent
0 message is sent to the PHP system log, using the operating system's logging mechanism or a file, depending on the setting of error_log in php.ini. This is the default option.
1 The message is sent to the email address set by the parameter destination. The fourth parameter extra_headers is only used in this type.
3 The message is sent to the location. destination file. The character message is not treated as a new line by default.
4 message sent directly to SAPI’s log handler
NOTE
The following levels of errors cannot be handled by user-defined functions: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most E_STRICT
error_reporting = E_ALL // Report error level, what level error_log = /tmp/php_errors.log // Log location of error display in php display_errors = On // Whether to display errors on the output, this output may be a page, It may also be stdoutdisplay_startup_errors = On // Whether to display the error information of the startup process on the page. Remember that there are several Core type errors mentioned above that occur during startup. This is to control whether these errors are displayed on the page. log_errors = On // Whether to record error logs log_errors_max_len = 1024 // Maximum length of error log ignore_repeated_errors = Off // Whether to ignore repeated errors track_errors = Off // Whether to use the global variable $php_errormsg to record the last error xmlrpc_errors = 0 / /Whether to use the XML-RPC error message format to record errors xmlrpc_error_number = 0 // Used as the value of the XML-RPC faultCode element. html_errors = On // Whether to turn the functions and other information in the output into HTML links docref_root = http://manual/en/ // If html_errors is turned on, what is the root path of this link fastcgi.logging = 0 // Whether to turn PHP errors are thrown into fastcgi
PHP defaults to the log and standard output (if it is fpm mode, the standard output is the page)
The parameter of error_reporting is the error level. Indicates what level should trigger an error
display_errors controls whether error information should be displayed on the standard output
log_errors controls whether error information should be recorded in the log
error_log is the location where the error log is displayed
<br/>