On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php error_log
between virtual hosts.
Overriding this setting in the <Location>
of the httpd.conf
does not seem to do anything.
Is there a way to have separate php error_logs
for each Virtual Host?
I usually just specify this in an
.htaccess
file or thevhost.conf
on the domain I'm working on. Add this to one of these files:Create Simple VirtualHost:
example hostname:-
thecontrolist.localhost
C:\Windows\System32\drivers\etc
127.0.0.1 thecontrolist.localhost
in hosts fileC:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *> ServerName thecontrolist.localhost ServerAlias thecontrolist.localhost DocumentRoot "/xampp/htdocs/thecontrolist" <Directory "/xampp/htdocs/thecontrolist"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost>
Don't Forget to restart Your apache. for more check this link
Have you tried adding the
php_value error_log '/path/to/php_error_log
to your VirtualHost configuration?To set the Apache (not the PHP) log, the easiest way to do this would be to do:
If there is no leading "/" it is assumed to be relative.
Apache Error Log Page
The default behaviour is for error_log() to output to the Apache error log. If this isn't happening check your php.ini settings for the error_log directive - leave it unset to use the Apache log file for the current vhost.
Yes, you can try,
in
.htaccess
or you can have users useini_set()
in the beginning of their scripts if they want to have logging.Another option would be to enable scripts to default to the
php.ini
in the folder with the script, then go to the user/host's root folder, then to the server's root, or something similar. This would allow hosts to add their ownphp.ini
values and their ownerror_log
locations.