Den här artikeln finns även på: Svenska
PHP errors that occur during runtime have their own log management, in contrast to http errors that are logged under
Errors in cPanel. You can find more information about this here.
By default, error messages from PHP are logged in an
error_log file which is created in the folder from where the script is run. This means that if a WordPress installation causes a PHP error, an
error_log file will be created in the document root for the installation.
Settings for error log management for PHP
You have access to various settings for management of error messages created through PHP via cPanel. To access these, please refer to the instructions here.
The settings responsible for error logging and messaging are
The various settings imply the following:
- display_error – decides whether or not warnings, error messages etc should be displayed at all.
- error_reporting – dictates what sorf of error messages that should be displayed and/or logged. If the logging level is preceded by a
~, that log level is disabled.
- E_ALL – all PHP error messages, warnings, and notices.
- E_NOTICE – notices regarding e.g. uninitialized variables, spelling mistakes etc.
- E_STRICT – an older type of messages depracated in PHP 7.0 and above. Will let the user know if a function is used in a sloppy way compared to default.
- E_DEPRECATED – implies that the code running is using e.g. outdated functions. Such a message means that the code probably will not work in upcoming PHP versions.
- log_errors – if this setting is enabled, error messages generated by PHP code will be logged to an
error_logfile located in the same directory on the server as the script that generated the error message.
You can also set more specific details for error_reporting via a
.user.ini file, in the same manner as we describe here. You can read more about all different levels/settings for error_reporting on the php.net website.