I am attempting to compile Magento and am receiving the following error:

Directory "/home/www/sitename/includes" must be writeable
File "/home/www/sitename/includes/config.php" must be writeable

Thing is, I've made sure both the includes directory and config.php ARE writable. I've chown'd both to the apache user, chgrp'd both to the apache user's group, chmod 755'd them and even chmod 777'd them as a last ditch effort. ls -l shows the following:

drwxrwxrwx.  3 apache apache 4096 May 21 22:16 includes

Fully open to anyone and everyone as far as the OS is concerned, but still Magento tells me the directory isn't writable. Am I missing something obvious?

  • 1
    What if you try to compile from command line? (php shell/compiler.php compile) – Kenny May 22 '13 at 7:19
  • Odd, it compiles from the command line but not the web interface... – David Perry May 23 '13 at 3:30

There could be a few reasons, the easiest way to diagnose is to log in via SSH and su to whoever PHP runs as. Then try writing to said file and dir.

If you are using PHP in a chroot, then make sure you chroot into the dir first.

Linux permissions go a little beyond just plain 777. If your file system is mounted with acl's then what you see isn't quite what you get. You can check by looking for acl in the mount options.

cat /process/mount

There is also a flag called immutable, which prevents write access to a file, regardless of acl's and permissions. You can unset it with

chattr -i config.php

Whilst the question was asked some time ago I had a recent occurrence of this, with a slightly different cause so thought I would share (as this post came up whilst searching). It took me days to resolve and was not a result of folder permissions.

Not only were the includes folder and includes/config.php files not writable but the the product thumbnails were not being created either. After trying everything under the sun I stumbled across the solution. The new server was running Centos 7. Now, as it turns out, Centos 7 has SELinux enabled by default. It was SELinux that was preventing the writing to these locations. Disabling that as a test proved it. Thumbnails all appeared and the includes were now writable.

Having found that out I was then able to locate some information about changing SELinux (amazing how you can find the answer when you already know it). I found this guide telling that instead of disabling it do this:

EDIT: WARNING - running the commands below stopped our httpd service from starting.

$ sudo restorecon -R /var/www/html
$ sudo setsebool -P httpd_unified 1

I found that here: http://linoxide.com/linux-how-to/setup-magento-community-edition-centos-7/

From my experience I cannot recommend doing that last bit. We have just left SELinux disabled for the time being.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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