Perform configuration
The error function is affected by the php.ini configuration file.
Error and log configuration options:
| Parameters |
Default Value |
Description |
Modifiable Range |
| Error_reporting |
Null |
Sets the error level for PHP and returns the current level (number or constant). |
Php_ini_all |
| Display_errors |
"1" |
This option sets whether to display error information to the screen as part of the output, or to hide it from the user. Note: This feature is not used in a live production environment (used during development testing) |
Php_ini_all |
| Display_startup_errors |
"0" |
Even if Display_errors is set to on, error messages during PHP startup are not displayed. It is strongly recommended that you set display_startup_errors to off, in addition to debugging purposes. |
Php_ini_all |
| Log_errors |
"0" |
Sets whether error messages that are run by the script are logged to the server error log or error_log. Note that this is a specific configuration item related to the server. |
Php_ini_all |
| Log_errors_max_len |
"1024" |
Sets the maximum number of bytes for the log_errors. The error_log will add information about the source of the error. The default value is 1024, and if set to 0 indicates an unlimited length. This length sets the error to the record, the error that is displayed, and the $php _errormsg will have a limiting effect. |
Php_ini_all |
| Ignore_repeated_errors |
"0" |
Duplicate information is not logged. Duplicate errors must appear on the same line of code in the same file unless Ignore_repeated_source is set to true. |
Php_ini_all |
| Ignore_repeated_source |
"0" |
When a duplicate message is ignored, the source of the message is also ignored. When this setting is turned on, the duplicate information will not be recorded by different files or different source code lines. |
Php_ini_all |
| Report_memleaks |
"1" |
If this parameter is set to OFF, the memory leak information is not displayed (in stdout or in the log). |
Php_ini_all |
| Track_errors |
"0" |
If turned on, the last error will always exist in the variable $php _errormsg. |
Php_ini_all |
| Html_errors |
"1" |
Close the HTML tag in the error message. |
Php_ini_all Php_ini_system in PHP <= 4.2.3. |
| Xmlrpc_errors |
"0" |
Closes the normal error report and formats the error message in the format of the XML-RPC error. |
Php_ini_system |
| Xmlrpc_error_number |
"0" |
The value used as the Xml-rpc faultcode element. |
Php_ini_all |
| Docref_root |
"" |
The new error message format contains the corresponding reference page, which is specific to the error, or describes the function that caused the error to occur. In order to provide a manual page, you can download the corresponding language manual at the official PHP site, and set the URL to the local address in the INI. If your local copy of the manual can be accessed using "/manual/", you can simply set the docref_root=/manual/. Also you need to set Docref_ext to match your local file suffix name docref_ext=.html. Of course, you can also set an external reference address. For example, you can set docref_root=http://manual/en/or docref_root= "http://landonize.it/?how=url&theme=classic&filter= Landon &url=http%3a%2f%2fwww.php.net%2f " |
Php_ini_all |
| Docref_ext |
"" |
See Docref_root. |
Php_ini_all |
| Error_prepend_string |
Null |
The contents of the output before the error message. |
Php_ini_all |
| Error_append_string |
Null |
The contents of the output after the error message. |
Php_ini_all |
| Error_log |
Null |
Sets the file to which the script error will be logged. The file must be writable by the Web server user. |
Php_ini_all |
Installation
The Error and Logging functions are part of the PHP core. 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 () |
Generate BackTrace. |
4 |
| Debug_print_backtrace () |
Print BackTrace. |
5 |
| Error_get_last () |
Get the last error that occurred. |
5 |
| Error_log () |
An error was sent to the server error record, file, or remote destination. |
4 |
| Error_reporting () |
Specify which error to report. |
4 |
| Restore_error_handler () |
Restore the previous error handler. |
4 |
| Restore_exception_handler () |
Restores the previous exception handler. |
5 |
| Set_error_handler () |
Sets the user-defined error handling function. |
4 |
| Set_exception_handler () |
Sets the user-defined exception handling function. |
5 |
| Trigger_error () |
Create a user-defined error message. |
4 |
| User_error () |
The alias of the 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 |
Run-time fatal error. The error cannot be fixed. Stops execution of the script. |
|
| 2 |
E_warning |
Run-time non-fatal error. The execution of the script is not stopped. |
|
| 4 |
E_parse |
Compile-time parsing error. Parsing errors should be generated only by the parser. |
|
| 8 |
E_notice |
The notification at run time. The script discovery may be an error, but it may also occur when the script is running normally. |
|
| 16 |
E_core_error |
Fatal error in PHP startup. This is like the PHP core e_error. |
4 |
| 32 |
E_core_warning |
A non-fatal error when PHP starts. This is like the PHP core e_warning. |
4 |
| 64 |
E_compile_error |
Compile-time fatal error. This is like the e_error generated by the Zend scripting engine. |
4 |
| 128 |
E_compile_warning |
Compile-time non-fatal error. This is like the e_warning generated by the Zend scripting engine. |
4 |
| 256 |
E_user_error |
User-generated fatal error. This is like the e_error generated by the programmer using PHP functions Trigger_error (). |
4 |
| 512 |
E_user_warning |
User-generated non-fatal error. This is like the e_warning generated by the programmer using PHP functions Trigger_error (). |
4 |
| 1024 |
E_user_notice |
User-generated notifications. This is like the e_notice generated by the programmer using PHP functions Trigger_error (). |
4 |
| 2048 |
E_strict |
The notification at run time. PHP recommends that you change the code to improve the interoperability and compatibility of your code. |
5 |
| 4096 |
E_recoverable_error |
A fatal error that can be caught. This is like a e_error that can be captured by a user-defined handle (see Set_error_handler ()). |
5 |
| 6143 |
E_all |
All levels of error and warning, except E_strict (since PHP 6.0, E_strict will be part of the E_all). |
5 |
PHP Directory function "2"