ConfigurationΒΆ

All configuration options related to error and exception handling are part of $TYPO3_CONF_VARS[SYS]:

Key Data type Description
displayErrors integer

Configures whether PHP errors should be displayed.

  • 0 = Do not display any PHP error messages. Overrides the value of "exceptionalErrors" and sets it to 0 (= no errors are turned into exceptions),the configured productionExceptionHandler is used as exception handler
  • 1 = Display error messages with the registered error handler,the configured debugExceptionHandler is used as exception handler
  • 2 = Display errors only if client matches $TYPO3_CONF_VARS[SYS][devIPmask]. If devIPmask matches the users IP address the configured "debugExceptionHandler" is used for exceptions, if not "productionExceptionHandler" will be used.
  • -1 = Default setting. With this option, you can override the PHP setting display_errors. If devIPmask matches the users IP address the configured debugExceptionHandler is used for exceptions, if not productionExceptionHandler will be used.
errorHandler string

Classname to handle PHP errors. Leave empty to disable error handling.

Default: \TYPO3\CMS\Core\Error\ErrorHandler. This class will register itself as error handler. It is able to write error messages to all available logging systems in TYPO3 (\TYPO3\CMS\Core\Utility\GeneralUtility::syslog, \TYPO3\CMS\Core\Utility\GeneralUtility::devlog() and to the "sys_log" table).

Additionally the errors can be displayed as flash messages in the Backend or in the adminpanel in Frontend. The flash messages in Backend are only displayed if the error and exception handling is in "debug-mode", which is the case when the configured "debugExceptionHandler" is registered as exception handler (see: $TYPO3_CONF_VARS[SYS][displayErrors]).

Errors which are registered as "exceptionalErrors" will be turned into exceptions (to be handled by the configured exceptionHandler).

errorHandlerErrors integer

The E_* constant that will be handled by the error handler

Default: E_ALL ^ E_NOTICE

exceptionalErrors integer

The E_* constant that will be handled as an exception by the error handler.

Default: E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER\_ERROR ^ E_USER\_NOTICE ^ E_USER\_WARNING (4341) and "0" if $TYPO3_CONF_VARS[SYS][displayErrors] = 0.

Refer to the PHP documentation for more details on this value.

productionExceptionHandler string

Classname to handle exceptions that might happen in the TYPO3-code.

Leave empty to disable exception handling.

Default: \TYPO3\CMS\Core\Error\ProductionExceptionHandler. This exception handler displays a nice error message when something went wrong. The error message is logged to the configured logs.

Note

The configured productionExceptionHandler is used if $TYPO3_CONF_VARS[SYS][displayErrors] is set to "0" or to "-1" and $TYPO3_CONF_VARS[SYS][devIPmask] doesn't match.

debugExceptionHandler string

Classname to handle exceptions that might happen in the TYPO3 code.

Leave empty to disable exception handling.

Default: \TYPO3\CMS\Core\Error\DebugExceptionHandler. This exception handler displays the complete stack trace of any encountered exception. The error message and the stack trace is logged to the configured logs.

Note

The configured debugExceptionHandler is used if $TYPO3_CONF_VARS[SYS][displayErrors] is set to "1" or if $TYPO3_CONF_VARS[SYS][displayErrors] is "-1" or "2" and the $TYPO3_CONF_VARS[SYS][devIPmask] matches.

enable_errorDLOG boolean Whether errors should be written to the Developer's Log (requires an installed *devlog extension).
enable_exceptions boolean Whether exceptions should be written to the Developer's Log (requires an installed *devlog extension).
syslogErrorReporting integer

Configures which PHP errors should be logged to the configured syslogs (see: [SYS][systemLog]). If set to "0" no PHP errors are logged to the syslog.

Default: E_ALL ^ E_NOTICE (6135).

belogErrorReporting integer

Configures which PHP errors should be logged to the "sys_log" table (extension: belog). If set to "0" no PHP errors are logged to the "sys_log" table.

Default: E_ALL ^ E_NOTICE (6135).

systemLog string

Configures which mechanism is used to log errors being logged using GeneralUtility::sysLog() calls. Multiple settings are possible by separating them with a semicolon.

Every distinct option can contain up to three values separated by comma. The first option defines the mechanism which is used for logging. The second option defines the destination/target of the log message. The third option defines a severity level. Messages will get logged to the mechanism/target only if the severity of the message is higher than the specified level. Giving "0" as level or not giving a level at all will log all messages. Possible options are:

  • file,<abs-path-to-file>[,<level>] = Writes the error messages to the specified file.
  • mail,<to>[/<from>][,<level>] = Sends an email for every error message to the configured email "<to>". Additionally sets the e-mail From header.
  • syslog,<facility>[,<level>] = Uses the PHP method "syslog" to send the log message. Depending on the operating system the message will get logged in different ways. On Linux (Debian, Ubuntu) the message will usually appear in /var/log/syslog if not configured otherwise. The <facility> option is not used currently.
  • error_log[,,<level>] = This setting will use the PHP method "error_log" to log the message. The message will get handled according to the settings of the variable "error_log" in the php.ini file.

Using the method "file" is very reliable but could also pose a security risk if you write error logs into the webroot of your site. The option "error_log" allows to use the same logging facility which is by default used by PHP scripts on the server. Be aware that on production machines error logging for PHP scripts could be disabled.

The table below shows which values can be set by the user and which are set by TYPO3.

Values in plain text can be changed in LocalConfiguration.php.

Values in bold are set by TYPO3.

displayErrors errorHandlerErrors exceptionalErrors errorHandler devIPmask exceptionHandler
display_errors
(php_ini)
-1 E_ALL ^ E_NOTICE E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE TYPO3CMS CoreError ErrorHandler Matters If devIPmask matches: debugExceptionHandler Not changed
If devIPmask doesn't match: productionExceptionHandler Not changed
0 E_ALL ^ E_NOTICE 0 (no errors are turned into exceptions) TYPO3CMS CoreError ErrorHandler Doesn't matter production ExceptionHandler 0 (Off)
1 E_ALL ^ E_NOTICE E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING TYPO3CMS CoreError ErrorHandler Doesn't matter debugException Handler 1 (On)
2 E_ALL ^ E_NOTICE E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING TYPO3CMS CoreError ErrorHandler Matters If devIPmask matches: debugExceptionHandler 1 (On)
If devIPmask doesn't match: productionExceptionHandler 0 (Off)

Tip

Search for php error calculator in the web.

PHP constants:

    1  E_ERROR            Fatal run-time errors.
    2  E_WARNING           Run-time warnings (non-fatal errors).
    4  E_PARSE             Compile-time parse errors.
    8  E_NOTICE            Run-time notices.
   16  E_CORE_ERROR        Fatal errors that occur during PHP's initial startup.
   32  E_CORE_WARNING      Warnings (non-fatal errors) that occur during PHP's initial startup.
   64  E_COMPILE_ERROR     Fatal compile-time errors.
  128  E_COMPILE_WARNING   Compile-time warnings (non-fatal errors).
  256  E_USER_ERROR        User-generated error message.
  512  E_USER_WARNING      User-generated warning message.
 1024  E_USER_NOTICE       User-generated notice message.
 2048  E_STRICT            Enable to have PHP suggest changes to your code.
 4096  E_RECOVERABLE_ERROR Catchable fatal error. It indicates that a probably dangerous error occurred, but did not leave the Engine in an unstable state. If the error is not caught by a user defined handle (see also set_error_handler()), the application aborts as it was an E_ERROR.         Since PHP 5.2.0
 8192  E_DEPRECATED        Run-time notices.
16384  E_USER_DEPRECATED   User-generated warning message.
----------------------------------------------------------------------------
32767  E_ALL               (Use ~0 in the code to set all bits.)

Defaults:

30711                      SYS/belogErrorReporting  = E_ALL & ~(E_STRICT | E_NOTICE)

30466                      SYS/errorHandlerErrors  = E_WARNING     | E_USER_ERROR        | E_USER_WARNING |
                                                     E_USER_NOTICE | E_RECOVERABLE_ERROR | E_DEPRECATED   |
                                                     E_USER_DEPRECATED

30711                      SYS/syslogErrorReporting = E_ALL & ~(E_STRICT | E_NOTICE)

Typical in TYPO3 for production:

20480                      SYS/exceptionalErrors   = E_RECOVERABLE_ERROR | E_USER_DEPRECATED

Typical in TYPO3 for development:

28674                      SYS/exceptionalErrors   = E_WARNING | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED

The following sections highlight the roles and goals of the various classes related to error and exception handling. Examples and custom handlers are also discussed.