PHP Function Reference

PHP Error Function - Runtime Configuration



The behavior of the error functions is affected by settings in php.ini.

Errors and logging configuration options

NameDefaultDescriptionChangeable
error_reportingNULLSet the error reporting level. The parameter is either an integer representing a bit field, or named constants.PHP_INI_ALL
display_errors"1"Determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.
Note: This feature is provided to support the development and should never be used on production systems.
PHP_INI_ALL
display_startup_errors"1"Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed. It's strongly recommended to keep display_startup_errors off, except for debugging.
Note: Prior to PHP 8.0.0, the default value was "0".
PHP_INI_ALL
log_errors"0"Defines whether script error messages should be logged to the server's error log or error_log. This option is thus server-specific.
Note: It is strongly advised to use error logging instead of error displaying on production web sites.
PHP_INI_ALL
log_errors_max_len"1024"Set the maximum length of log_errors in bytes. In error_log information about the source is added. The default is 1024 and 0 allows to not apply any maximum length at all. This length is applied to logged errors, displayed errors and also to $php_errormsg, but not to explicitly called functions such as error_log().PHP_INI_ALL
ignore_repeated_errors"0"Do not log repeated messages. Repeated errors must occur in the same file on the same line unless it is set to "1".PHP_INI_ALL
ignore_repeated_source"0"Ignore source of message when ignoring repeated messages. When set to "1" it will not log errors with repeated messages from different files or source lines.PHP_INI_ALL
report_memleaks"1"If set to "1" (the default), this parameter will show a report of memory leaks detected by the Zend memory manager.PHP_INI_ALL
track_errors"0"If enabled, the last error message will always be present in the variable $php_errormsg.
Note: Deprecated as of PHP 7.2.0, removed as of PHP 8.0.0.
PHP_INI_ALL
html_errors"1"If enabled, error messages will include HTML tags. The format for HTML errors produces clickable messages that direct the user to a page describing the error or function in causing the error. These references are affected by docref_root and docref_ext. If disabled, error message will be solely plain text.PHP_INI_ALL
xmlrpc_errors"0"If enabled, turns off normal error reporting and formats errors as XML-RPC error message.PHP_INI_SYSTEM
xmlrpc_error_number"0"Used as the value of the XML-RPC faultCode element.PHP_INI_ALL
docref_root""The new error format contains a reference to a page describing the error or function causing the error. In case of manual pages we can download the manual in the language and set this ini directive to the URL of our local copy. If our local copy of the manual can be reached by "/manual/" we can simply use docref_root=/manual/. Additional we have to set docref_ext to match the file extensions of our copy docref_ext=.html. It is possible to use external references. For example - 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"
Note: This is a feature to support the development since it makes it easy to lookup a function description. However it should never be used on production systems.
PHP_INI_ALL
docref_ext""See docref_root.
Note: The value of docref_ext must begin with a dot ".".
PHP_INI_ALL
error_prepend_stringNULLString to output before an error messagePHP_INI_ALL
error_append_stringNULLString to output after an error message.PHP_INI_ALL
error_logNULLSpecify the name of the file where script errors should be logged. The file should be writable by the web server's user. If the special value syslog is used, the errors are sent to the system logger instead.PHP_INI_ALL
syslog.facility"LOG_USER"Specify what type of program is logging the message. Only effective if error_log is set to "syslog".
Note: Available as of PHP 7.3.0.
PHP_INI_SYSTEM
syslog.filter"no-ctrl"Specify the filter type to filter the logged messages. Allowed characters are passed unmodified. All others are written in their hexadecimal representation prefixed with \x.
  • all – the logged string will be split at newline characters, and all characters are passed unaltered
  • ascii – the logged string will be split at newline characters, and any non-printable 7-bit ASCII characters will be escaped
  • no-ctrl – the logged string will be split at newline characters, and any non-printable characters will be escaped
  • raw – all characters are passed to the system logger unaltered, without splitting at newlines
This setting will affect logging via error_log set to "syslog" and calls to syslog().
Note: Available as of PHP 7.3.0. The raw filter type is available as of PHP 7.3.8 and PHP 7.4.0. This directive is not supported on Windows.
PHP_INI_ALL
syslog.ident"php"Specify the ident string which is prepended to every message. Only effective if error_log is set to "syslog".
Note: Available as of PHP 7.3.0.
PHP_INI_SYSTEM

❮ PHP Error Handling Reference