WordPress: Unable To Create Directory Error

WordPress: Unable To Create Directory Error

This article describes how to securely fix the wordpress “Unable To Create Directory Error”

This is a general permissions error and may be uncovered in a variety of situations; the most common of these is when trying to upload images:

“Unable to create directory /wp-content/uploads//. Is its parent directory writable by the server?”

There are many various articles about this error and horrifically, a lot of them advise fixes which are glaring security holes and can / will lead to compromise of the web server.

They look something like this: “Change permission of directories to 757 or 777” – doing this allows anyone on the internet to upload write files to your directory!!!

Here is the secure solution:

  1. Check to see which user & group the apache web server runs under. This information is held in the /etc/apache2/envvars file and you can view it as follows:
    Wordpress: Unable To Create Directory Error Fix

    Apache RUN Vars

  2. Create the directory in question if necessary – note: it may already exist:
    Wordpress Unable to Create Directory Error

    Create uploads Directory

  3. Change the group ownership of the directory to the group apache runs under – in this caseĀ  you can see that the group is “www-data”:
    Wordpress Unable to Create Directory Error

    Change group permissions

  4. Assign write permission to the group for that directory:
    Wordpress Unable To Create Directory Error

    Change Group Permissions

Job done!

Leave a Reply

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