If you’re trying to upgrade WordPress or install a plugin and getting the “could not create directory” error, there are two levels required to solving it.

Here’s an example of the error sequence:

Downloading update from http://downloads.wordpress.org/plugin/your-plugin.0.9.3.1.zip…
Unpacking the update…
Could not create directory. /wp-content/upgrade/yourplugin.tmp
Return to Plugins page

1. Web Server Ownership
The first level is actually to make sure that your web server has ownership over the directories:
chown -R www-data:www-data your-wordpress-directory

2. Directory Permissions
The second level is also required – you must make sure that the directory permissions are properly set:
sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;

I’ve found that most solutions posted on the web show part two but skip the first part.


Packages



WordPress Support Packages
If you’re looking for WordPress help, we now offer generalized WordPress consulting and support packages at an introductory low price. You can purchase them in three, five or ten hour blocks.

And, of course, we offer our pre-installed WordPress Quickstart images.

About The Author

  • Hi, sorry, where should I write this: chown -R www-data:www-data your-wordpress-directory? Is it in FTP?

    • atomthegod

      Into console on server

  • Fernando Ferreira de Paula

    Thank you.
    It worked perfectly

  • Leoui

    Thank you so much! It’s awesome! Worked perfectly for my WordPress.

  • Adarsh Sojitra

    You made my day with this single post… I was trying to do so on my VPS since many days… Finally, i did that by the help of your post…. thank you so much… actually, I forgot to take ownership of files and that was the problem

  • Awesome!
    For me, set owner of wp-content do the trick, but seems in future access to whole folder requered…

    • XEL Media & Design

      how?

      • Exactly as described in 1. Web Server Ownership set:

        chown -R www-data:www-data ./my-wordpress-directory/wp-content

  • Worked Great thanks!

  • Mohamed Hafez

    working like charm

  • zholley

    Finally! Been working on this for two days after a migration. Thanks!

  • Felipe

    As permissões eu já havia dado, e nada de instalar. Consegui executando o comando no SSH. Thank you!

  • Mark Dannon

    Atlast, something that works.

  • Alexandru Contes

    God bless you!

  • Tiffaynee Horsley

    Can anyone break this down into laman’s terms for a total WP newbie?? We just experienced our first “white screen of death” and after a TON of run around from BlueHost, we finally got that issue resolved, but now all our plugins have ‘disappeared’ and I keep getting this same error message.

    • Jacob Robinson

      Hi Tiffaynee,
      What you’re describing tells us that your permissions or file ownership is incorrect, hence why you cannot see your plugins. As a general rule of thumb, files should have the permissions of 0644 or 0755 if required and 0755 for directories.

      Your current hosting provider will be able to resolve this issue for you but if they’re not then please do feel free to reach out to me at Jacob@aboveclouds.co.uk

      Many thanks,
      Jacob Robinson.

  • zerohero

    this does not work

    • Dev Mo

      Hey ZeroHero,
      If you’re using a Mac…
      – Open Finder
      – Locate the ‘wp-content’ folder
      – Right click and select ‘Get Info’
      – Click the lock at the bottom right to unlock
      – Change your permissions to ‘Read & Write’
      – Click the little wheel at the bottom left to Apply changes

      (Follow similar steps if using Linux)

  • hieuvo

    your post is really helpful, I’ve struggled with this issue for a long time

  • Matt Mintun

    Thank you!! this was a huge help. for any confused by the “www-data:www-data” just use it, it works. and your WP directly needs to be relative to root. for mine it was /var/www/[domain] with NO trailing slash.

  • Stephen Kuehl

    This worked for me. Thanks!

  • Jaime Tun

    Hi,
    I think my installation is really messed up. After changing the permissions, it now tells me that i do not have access to that directory in the server.
    I re installed WP again.
    I was thinking that maybe i have to create the user www-data.
    How can i go about doing that?
    Thanks for all the help.

  • Fred Morgan

    Thanks Jeff for a great article which fixed it for me. chown -R www-data:www-data your-wordpress-directory fixed it and you are right all articles focus on the permissions not the ownership.

  • Juan Sebastian Botero

    Thanks Jeff, would you please add the steps for Windows Hosting?

    • Sorry, I’m not a fan of Windows anymore or Windows hosting.

      • Reagan MUHOZA

        Hello Jeff, can you please state the steps you mentioned above in a way a wordpress beginner could easily get it?
        My website is already online. I would like to get all the steps.
        Hope to hear from you soon.
        Regards

  • Arun Kasyakar

    I am using Fedora OS
    i have set chown -R apache:apache your-wordpress-directory
    and also
    sudo find /var/www/wordpress/ -type d -exec chmod 755 {} ;
    sudo find /var/www/wordpress/ -type f -exec chmod 644 {} ;

    then also i am getting the same problem “Installation failed: Could not create directory.”

  • Jym Valentine

    Thanks for this, I was having issues installing plugins from the repo on a local testing server which I haven’t setup FTP on as I use sFTP instead.

    • Sime

      Hey, how exactly did you fix that problem?

      • Jym Valentine

        Hi, I did one other step other than listed above, I also added:

        define(‘FS_METHOD’,’direct’);

        to the bottom of my wp-config.php file, this forces wordpress to install mods/themes directly rather than using FTP.

        Once you’ve done that follow the instructions in the article and you should be able to install plugins.

  • Halil İbrahim Oymacı

    It works. Thanks a lot.

  • Martial Tchuente

    Thanks, it worked for me. In my own case, just level 1: Web Server Ownership fixed it. And since I use opensuse Leap 42.1, I had to run the command: chown -R wwwrun:www your-wordpress-directory.

  • Thank you very much; it worked perfectly. Initialy I did my version of these changes but somehow I managed to mess my wordpress instalation.

  • Niraj Gupta

    Superb Solution, Worked Like Charm. Thanks a ton.

  • Rôney Fischer Silva

    MUITO OBRIGADO.
    Não costumo comentar, mas isso foi uma excelente ajuda.
    Já tentei de tudo, e não havia conseguido, Muitíssimo obrigado.
    Thanks!!

    Att,

    Rôney FIscher