0

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>
  • Drupal also logs errors for him self. Did you check under Reports -> Recent log messages? Maybe that can be helpful for you? – MilanG Sep 11 '19 at 08:54

2 Answers2

0

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?

KalleVu
  • 23
  • 5
0

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>
hoover_D
  • 620
  • 4
  • 9