/
/
PHP error logging

PHP error logging

In ispmanager 6

To ensure maximum PHP error logging level, enable the log_errors and Report all errors options in the settings for the required PHP version in the control panel.

PHP errors are registered in the web server log at /var/www/httpd-logs/%SITE_NAME%.error.log. This log is available in the Sites section.

In console

PHP error logs are stored in the directory of a specific handler, for example:

  • For PHP 7.4 in Apache module mode /var/log/apache2-isp-php74/error.log
  • For PHP 8.3 in PHP-FPM mode /var/log/php8.3-fpm.log

Alternatively, you can create and configure your own PHP error log.

First, create a file that will serve as the error log, for example at /var/log/php_errors.log, and set the correct permissions for it:

touch /var/log/php_errors.log
chown www-data:www-data /var/log/php_errors.log
chmod 664 /var/log/php_errors.log

Next, in the configuration file for the desired PHP version at /opt/php%PHP_VERSION%/etc/php.ini, enable error logging in the log_errors directive and specify the path to the log for the error_log directive.

After making the change, restart the handler and web server with the following commands:

systemctl restart php%PHP_VERSION%
systemctl restart nginx #if PHP runs on Nginx
systemctl restart apache2 #if PHP runs on Apache

For example, for PHP version 8.1, change the file at /opt/php81/etc/php.ini and reload the handler with the following command:

systemctl restart php81

In this article