skip to Main Content

I am setting up a webserver in CentOS 7 with multiple virtual hosts which includes a drupal website. I want to log the PHP errors of my Drupal website, say ‘mysite’ to a custom file say, /var/log/httpd/mysite_error.log. I have set this up in the httpd conf file of the virtual host (and this has worked for non-Drupal sites) but the errors are still logged to /var/log/php_error.log.

httpd conf file of the virtual host mysite (/etc/httpd/sites-available/mysite):

<VirtualHost *:80>
    ServerName mysite
    DocumentRoot /var/www/html/mysite/
    <Directory "/var/www/html/mysite">
        AllowOverride All
    </Directory>
    ErrorLog /var/log/httpd/mysite_error.log
    CustomLog /var/log/httpd/error_log combined
</VirtualHost>

2

Answers


  1. You’re just defining the Apache error log. For php you need php_value error_log /path/to.log.

    See most topvoted answer at error_log per Virtual Host?

    Login or Signup to reply.
  2. For Php Errors you have to configure them too, and they’re are not ErrorLog or CustomLog as you declared here, these are servers log. Php errors variables start with php_value or php_flag.

    <VirtualHost *:80>
        ServerName mysite
        DocumentRoot /var/www/html/mysite/
        <Directory "/var/www/html/mysite">
            AllowOverride All
        </Directory>
        ErrorLog /var/log/httpd/mysite_error.log
        CustomLog /var/log/httpd/error_log combined
        php_flag log_errors on
        php_flag display_errors on
        php_value error_reporting 2147483647
        php_value error_log /var/www/domains/example.com/php.error.log
    </VirtualHost>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search