Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason, apache doesn't seem to be able to write to it's own directory! (/var/www). error_log simply fails to output to files. Any help here would be great

I am using ubuntu 12.04 with apache2 and php-mod. I have noticed this same issue on every single ubuntu install, so it isn't local to this server. It seems like the vanilla configuration for the apache2 package doesn't give write permissions to itself for /var/www

Here's a little more info regarding the permissions:

$ ls -l /var/www
total 20
drwxrwxr-x 7 jenkins www-data 4096 Apr 22 14:09 healthtrustsoftware
-rwxrwxr-x 1 jenkins root      177 Mar 27 23:00 INDEX.html
drwxrwxr-x 2 root    root     4096 Apr 30 09:38 nas
drwxrwxr-x 2 jenkins www-data 4096 Mar 27 23:30 test
-rwxrwxr-x 1 root    root       48 Apr 30 09:35 test.php

ps -ef | grep apache output:

$ ps -ef | grep apache
root     13331     1  0 Apr26 ?        00:00:02 /usr/sbin/apache2 -k start
www-data 16540 13331  0 Apr28 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 16541 13331  0 Apr28 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 16542 13331  0 Apr28 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 16543 13331  0 Apr28 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 16544 13331  0 Apr28 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 21876 13331  0 09:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 21877 13331  0 09:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 21878 13331  0 09:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 21879 13331  0 09:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 22203 13331  0 09:29 ?        00:00:00 /usr/sbin/apache2 -k start
xxxxxx   23099 22965  0 10:18 pts/1    00:00:00 grep --color=auto apache

Also, it appears that error_log doesn't even create the file.

Jenkins user has ownership because we use jenkins for automated deployment via FTP. However, the entire www-data group should have the same permissions as the primary user, and since apache should be part of the www-data group, this should work should it not? Thanks for the help

share|improve this question
Which distribution are you using? Include the version. Is SELinux enforced? – Mircea Vutcovici Apr 30 '13 at 15:02
This question is likely to be closed due to its lack of detail. See How can I ask better questions on Server Fault? for guidance on improving it. – Michael Hampton Apr 30 '13 at 15:03
give the output of the /var/www/ ls -alh command so we can see the permissions that are set. what user is apache running as (ps -ef | grep apache). – ETL Apr 30 '13 at 15:10
Okay, I updated the information. – Andrew Rhyne Apr 30 '13 at 15:18
Apache should generally NOT be able to write to the webroot. Why do you require this? – voretaq7 Apr 30 '13 at 19:00

You should check if your server is under read-only mode, create a test file and enter some test and save and exit, if you can so means its ok not in read-only mode.

check disk space on server as below:

df -h

if everything ok then check attributes of error_log file.

share|improve this answer

Well, I figured it out, lol.

I dropped back a directory and noticed that ownership was to jenkins and ROOT group, not www-data group. So I did this:

cd /var
sudo chown -R jenkins:www-data www

And now it works.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.