Wordpress Permissions OS X & MAMP

Posted by Matt2020 on Super User See other posts from Super User or by Matt2020
Published on 2011-05-14T14:45:07Z Indexed on 2012/07/10 21:19 UTC
Read the original article Hit count: 298

I have installed several local versions of Wordpress for development purposes.

After the install I can create posts, pages and edit admin options.

However as soon as try to upload images which would be saved in wp_content/uploads I get an error:

Upload Error: Unable to create directory ...../blog/wp-content/uploads/2011/05. Is its parent directory writable by the server?

Looks like MAMP server runs as user _www The blog directory is owned by User1 and the group User1 _www is not in the User1 group, should it be? I do not want to chmod 777 or 765 on the directories just to get it going. Googled up a couple of references:

http://codex.wordpress.org/Changing_File_Permissions in "Permission Scheme for WordPress"

All files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared hosts, files should never be owned by the webserver process itself (sometimes this is www, or apache, or nobody user).

Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress (which may be different than the server account). For example, you may have a user account that lets you FTP files back and forth to your server, but your server itself may run using a separate user, in a separate usergroup, such as dhapache or nobody. If WordPress is running as the FTP account, that account needs to have write access, i.e., be the owner of the files, or belong to a group that has write access. In the latter case, that would mean permissions are set more permissively than default (for example, 775 rather than 755 for folders, and 664 instead of 644).

User and group are User1 (which is admin). Running "ps aux | grep httpd" is running as _www So I think this means Wordpress is running as user _www. So the advice seems contradictory: "files should never be owned by the webserver process" i.e. _www but then later it says "Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress" So isn't this _www again?

Another search found this url http://dancingengineer.com/computing/2009/07/how-to-install-wordpress-on-mac-os-x-leopard States Which says:

My preferred way to do this is to change the group of the wordpress directory and its contents to _www and give write permissions to the group. Keep the owner as your "username".

$ cd /Users/"username"/Sites

$ sudo chown -R username:_www wordpress_directory

$ sudo chmod -R g+w wordpress_directory

However, when I tried this, it did not work for automatic upgrades to newer versions of WordPress although it worked for automatically updating the .htaccess file for pretty permalinks.

It is not entirely clear to me what should be done. This last suggestion seems to be saying change the group from User1 to _www and give the group write access, but Wordpress upgrades won't work.

Is this the right solution?
I would have thought there would be a clear way to set this up on OS X 10.6?

Be great if there was a plugin that could run a script for each of the main OS's that Wordpress runs on.

© Super User or respective owner

Related posts about osx-snow-leopard

Related posts about permissions