I want to log apache2 and php errors in separated files:
I create a directory in: /var/log/apache2/mydomain.com
. this is the location where the log files are stored.
I edited my /etc/apache2/sites-available/mydomain.com.conf
:
<VirtualHost *:80>
ServerName mydomain.com
ServerAdmin webmaster@localhost
ServerAlias mydomain.com
DocumentRoot /var/www/mydomain.com/public
php_flag display_errors Off
php_flag log_errors On
php_value log_errors_max_len 0
php_value error_reporting 6135
ErrorLog /var/log/apache2/mydomain.com/mydomain.com.error.log
CustomLog /var/log/apache2/mydomain.com/mydomain.com.access.log common
php_value error_log /var/log/apache2/mydomain.com/mydomain.com.php.error.log
<Directory "/var/www/mydomain.com/public">
Options FollowSymLinks
AllowOverride All
</Directory>
Important settings:
- php_flag display_errors Off
- php_flag log_errors On
- php_value log_errors_max_len 0
- php_value error_reporting 6135
- php_value error_log /var/log/apache2/mydomain.com/mydomain.com.php.error.log
But the file: mydomain.com.php.error.log
is not created, instead all the PHP errors are added to the mydomain.com.error.log file.
apache2 is able to write in the directory: /var/log/mydomain.com
(tested, if i remove the file: mydomain.com.error.log
. it will be recreated)
there are no log related settings in my .htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
when i edit the /etc/apache2/sites-available/mydomain.conf
file, i run: sudo service apache2 restart
afterwards.
Do you see anything that is wrong or is there a reason why it might not work?