The
PHP error and logging introduction
error and logging functions allow you to process and record errors. The
error function allows the user to define error-handling rules and modify how the error is logged. The
logging function allows users to log applications and send log messages to e-mail, system logs, or other machines. The
Install
error and logging functions are part of the core of PHP. These functions can be used without installation.
PHP Error and Logging functions
PHP: Indicates the earliest version of PHP that supports this function.
function Description php
Debug_backtrace () build BackTrace. 4
Debug_print_backtrace () output backtrace. 5
Error_get_last () Get the last error. 5
Error_log () sends an error to a server error record, file, or remote destination. 4
error_reporting () Specify which error to report. 4
Restore_error_handler () error handlers before recovery. 4
Restore_exception_handler () The exception handler before the restore. 5
Set_error_handler () Set user-defined error-handling functions. 4
Set_exception_handler () Set user-defined exception handling functions. 5
Trigger_error () Create user-customized error messages. 4 the alias of the
User_error () trigger_error (). 4
PHP Error and Logging constants
PHP: Indicates the earliest version of PHP that supports this constant.
Value Constants Description php
1 e_error fatal run-time error. The error cannot be recovered. Execution of the script was interrupted.
2 e_warning non-fatal run-time error. Script execution is not interrupted.
4 e_parse Compile-time syntax parsing error. Parsing errors should only be generated by the parser.
8 e_notice run-time prompts. May be an error, or it may occur while the script is running normally.
e_core_error errors generated internally by PHP. 4
e_core_warning warnings generated internally by PHP. 4
e_compile_error Errors generated internally by the Zend script engine. 4
128 e_compile_warning A warning generated internally by the Zend scripting engine.  4
256 e_user_error A run-time error generated by invoking the Trigger_error () function. 4
e_user_warning A run-time warning generated by invoking the Trigger_error () function. 4
1024 e_user_notice A run-time hint generated by invoking the Trigger_error () function. 4
2048 e_strict run-time prompts. Useful for enhancing the interoperability and compatibility of your code. 5
4096 e_recoverable_error Fatal error that can be caught. (see Set_error_handler ()) 5
8191 e_all All errors and warnings except E_strict. 5