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 virtu
Yes, you can try,
php_value error_log "/var/log/php_log"
in .htaccess
or you can have users use ini_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 own php.ini
values and their own error_log
locations.
Don't set error_log
to where your syslog
stuff goes, eg /var/log/apache2
, because they errors will get intercepted by ErrorLog
. Instead, create a subdir
in your project folder for logs and do php_value
error_log "/path/to/project/logs"
. This goes for both .htaccess
files and vhosts. Also make sure you put php_flag
log_errors
on
Create Simple VirtualHost:
example hostname:- thecontrolist.localhost
C:\Windows\System32\drivers\etc
127.0.0.1 thecontrolist.localhost
in hosts file
C:\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
You can try:
<VirtualHost myvhost:80>
php_value error_log "/var/log/httpd/vhost_php_error_log"
</Virtual Host>
But I'm not sure if it is going to work. I tried on my sites with no success.
I usually just specify this in an .htaccess
file or the vhost.conf
on the domain I'm working on. Add this to one of these files:
php_admin_value error_log "/var/www/vhosts/example.com/error_log"