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
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?
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.