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?
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
If somebody comes looking it should look like this:
This is for development only since
display_error
is turned on. You will notice that the Apache error log is separate from the PHP error log. The good stuff is inphp.error.log
.Take a look here for the
error_reporting
key http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reportingI 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: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.
Don't set
error_log
to where yoursyslog
stuff goes,eg /var/log/apache2
, because they errors will get intercepted byErrorLog
. Instead, create asubdir
in your project folder for logs and dophp_value
error_log "/path/to/project/logs"
. This goes for both.htaccess
files and vhosts. Also make sure you putphp_flag
log_errors
onHave you tried adding the
php_value error_log '/path/to/php_error_log
to your VirtualHost configuration?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.It works for me, but I have to change the permission of the log file.
or Apache will write the log to the its
error_log
.My Apache had something like this in httpd.conf. Just change the ErrorLog and CustomLog settings
You could try:
But i'm not sure if is going to work. I tried on my sites with no success.
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
Don't Forget to restart Your apache. for more check this link