Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unpacking the update... Could not create directory. Wordpress

When I instal nextgen-gallery plugins. This error message appears

Downloading update from https://downloads.wordpress.org/plugin/nextgen-gallery.zip…

Unpacking the update…

Could not create directory.

How can I fix this problem ?

like image 494
BigTech Avatar asked Dec 03 '13 19:12

BigTech


People also ask

Can not create directory?

That's when you'll see an error such as “Installation failed: could not create directory.” This error is your server's way of saying that you're not allowed to make changes to your site's files by adding the plugin or theme in question. In general, this is a problem that usually occurs on new WordPress sites.

How do I force WordPress to update?

To force automatic updates, you need to switch to Advanced tab under Update Options page and click on the 'Force updates' button. For more detailed instructions on updating WordPress plugins, please see our guide on how to better manage automatic WordPress updates.


3 Answers

This is a permissions issue. Ensure the directory is writable by apache. Plugins are unpacked into the wp-content/plugins directory, so I would first attempt writing to the directory as apache:

sudo -u apache touch /path/to/wp-content/plugins/test.txt

Set permissions accordingly to correct the issue. You can read about permissions here: https://www.pluralsight.com/blog/it-ops/linux-file-permissions

You can read about the correct file permission scheme for Wordpress here: https://wordpress.org/support/article/changing-file-permissions/

like image 173
skrilled Avatar answered Oct 22 '22 18:10

skrilled


@skrilled and @knutole's answer was great but I found that when attempting to fix the issue on the plugins folder, everything was ok and the answer did not work for me.

If anyone else has this issue, try looking at the upgrades folder also. This folder (from what I can see) is used as a folder to store temporary files for when WP upgrades or plugin updates are being ran.

If you simply receive the message stating 'Could not create directory' and there is no path specified, it could actually be talking about the upgrades folder.

like image 25
damienoneill2001 Avatar answered Oct 22 '22 18:10

damienoneill2001


Most likely, if you have configured it correctly, the http server associated to your wordpress site belongs to the group www-data. That's how one should configure it correctly.

Try members www-data and ps aux | grep www-data to be sure. In the latter command you should see on the last columns either nginx or apache.

In this case, you just need to set that group to the directory

sudo chgrp -R www-data <your_wordpress_root_dir>/

and then add full group permissions to such directory

sudo chmod -R g+rwx <your_wordpress_root_dir>/

Now it works perfectly :)

like image 45
João Pimentel Ferreira Avatar answered Oct 22 '22 18:10

João Pimentel Ferreira