I'm running apache2 with php5 on Linux Mint 13 Maya. I have defined a virtual host and these two entries there:

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

That produces error and access logs in var/log/apache2.

I want to make my PHP errors go in PHP error log. In my /etc/php5/apache2/php.ini I have set:

display_errors = On
log_errors = On
error_log = /var/log/php-errors.log
log_errors_max_len = 0
error_reporting =  E_ALL | E_STRICT

The log file /var/log/php-errors.log got generated, but all it logged was two warnings that some modules were already loaded. I tried to comment out the log directives in virtual host defintion but that changed nothing, all the errors are still logged in apache log.

What am I missing here?

1 Answer 1


It's possible that the permissions are not sufficient to write into that file; you also have to make sure that the directory is reachable too.

Example how it was on my system (this was standard Debian wheezy installation):

$ ls -ld /var/log/apache2/
drwxr-x--- 2 root adm 4096 Sep  4 15:59 /var/log/apache2/
$ ls -ld /var/log/apache2/php-error.log
-rw-r--r-- 1 www-data www-data 0 Jul 23 11:07 /var/log/apache2/php-error.log

This didn't work, because the directory containing the php-error.log wasn't reachable. Luckily mod_php (or apache2?) falls back to write it into the VirtualHosts error log.

In my case, it was easily fixable by applying chmod o+rx /var/log/apache2/ but your security considerations may vary. After the fix:

$ ls -ld /var/log/apache2/
drwxr-xr-x 2 root adm 4096 Sep  4 15:59 /var/log/apache2/

And with that change it worked.

PS: First, I had the same problem you had, couldn't solve it within a day. Google searching turned nothing up. Thought about writing a question on serverfault. While preparing title I got the suggestions and yours was the second hit. I realized I would write a duplicate question so I thought I write a comment at yours. But then I wanted to write more and thought about writing an answer which wouldn't solve the problem but would lead to my perspective too, maybe someone else could help. And while preparing the answer, I discovered the solution. This is absolutely fantastic about ... well, anything here. serverfault/stackexchange helped me find the solution on my own implicitly with the help of others. Can't get better, I guess (besides solving it on my own).

  • 2
    got me to the right path. But I had to use chmod a+rwx /var/log/httpd to get it working. Credit to an SO Answer [PHP error_log method doesn't write errors to my error log file ](stackoverflow.com/a/24210515/965067)
    – Delcon
    Jan 4, 2018 at 10:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .