If you ever find that you are creating a folder with PHP, and its immediately not writeable by Apache, then you’ve probably done what I did with the chmod. It needs to be an octal value, and PHP will not assume it is. So you have to prefix with a zero.

mkdir("/path/to/folder/structure/", 777, true);

Should actually be:

mkdir("/path/to/folder/structure/", 0777, true);

Took me a while to work it out, I thought it was something to do with Mac permissions…

By admin

One thought on “Apache PHP mkdir not writable?”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.