WordPress Error: Unable to create directory / Is its parent directory writable by the server?

If you get this error when you try to upload an image to your WordPress blog, there are two things you can do:

  1. Go to Settings > Miscellaneous in your WordPress admin area and make sure that ‘Store uploads in this folder’ is set to the default: wp-content/uploads (notice there is no ‘/’ before wp-content/uploads).  Try to upload again and see if it works.
  2. If that didn’t work, open up a terminal and navigate to the wp-content directory.  If wp-content does not contain sub-directory called ‘uploads’, create one and then change its permissions to wide open (sudo chmod 777 uploads/). Try to upload the image again.  If this works, navigate to the wp-content/uploads/ directory and check the owner of the image you just uploaded (ls -l). It will probably be something weird you’ve never seen before (mine was ‘www-data’). Navigate up a directory and change the owner of the uploads folder to the one WordPress want to use: sudo chown www-data:www:data. Then revert the permissions back to something a little safer: sudo chmod 755 uploads/ and you’re done.
This entry was posted in Musings and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted December 13 2011 at 9:16 am | Permalink

    ok
    thanks for all

One Trackback

  1. By 关于wordpress的两点 | AlexWei的回收站 on March 29 2011 at 6:58 am

    [...] 如果新安装的wordpress上传文件或者安装插件/主题失败,可能是apache的用户对发布路径的权限问题。 但如果将wp-content目录的权限设为777则危险太大了,应该将发布路径的所有者改为apache的用户即可。 在上传一张图片后可知apache进程所属的用户www-data http://likesalmon.net/wordpress-error-unable-to-create-directory-is-its-parent-directory-writable-by... [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>