PHP Error Logs with Virtuozzo

Virtuozzo sets domains up to have PHP’s display_errors flag turned off by default, so that you’ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you’re trying to debug something.

Instead of displaying the errors, you can configure PHP to log them and then use the logs for debugging. For a Linux environment, you’ll need to create a file named vhost.conf inside the domain’s conf directory, /var/www/vhosts/domain.name/conf.

<Directory /var/www/vhosts/domain.name>
  php_value error_log /var/www/vhosts/domain.name/statistics/logs/php-errors.log
  php_flag display_errors off
  php_value error_reporting 6143
  php_flag log_errors on
</Directory>

Then create the file and assign it the right permissions

  cd /var/www/vhosts/domain.name/statistics/logs/
  touch php-errors.log
  chown apache php-errors.log

And the last thing is to tell Apache to reread the updated conf file

  /usr/local/psa/admin/sbin/websrvmng -a

Leave a Reply

Your email address will not be published. Required fields are marked *