Unpacking the update... Could not create directory. Wordpress
Asked Answered
S

11

14

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 ?

Schizogenesis answered 3/12, 2013 at 19:54 Comment(2)
Does WordPress have write permission to the plugins directory? Can install any other plugin the same way?Megara
nginx , php-fpm , user and group and also file and folder permissions are answered in hereReplication
G
24

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/

Granophyre answered 3/12, 2013 at 19:59 Comment(1)
the first link seems to have expired. Currently you can lokk here: pluralsight.com/blog/it-ops/linux-file-permissionsFeaturelength
A
21

@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.

Amphibology answered 2/4, 2014 at 10:1 Comment(12)
I had the exact same problem. I solved it by giving 777 to wp-content/ folder. Not the neatest way, but solved my issue.Cookbook
I got this error until I gave 777 permissions to wp-content/upgrade and wp-content/plugins, but how can I change it back to more secure permissions (not 777!) and have it still work??Cyrilcyrill
Hi Ryan, once you have ran the update successfully, just swap it back to 755Amphibology
I found the answer. I changed permissions of those 2 folders back to 755 and then did a recursive chown like this: wordpress.stackexchange.com/a/23569/51462 Now I can keep them at 755.Cyrilcyrill
Setting 777 to upgrade folder finally got it working for me. Had set 777 for plugins and wp-contents but it didn't work, cause like you said the upgrade folder had to be changed too.Songster
@Amphibology addressed the issue well. so, the solution that worked for me is: chmod -R g+w wp-content/upgrade , but before running this command make sure that upgrade folder has a group of apache or www-data or whatever the webserver user is.Gil
well I solved my issue by creating "upgrade" directory and then chowning wordpress directory to www-data(webserver user)Kelter
I did sudo chmod 777 wordpress/**/* which fixed the issue.Scapular
Changing permissions recursively to 777 throughout the entire wp-content folder is asking for trouble and definitely not preferred. Files should be 644, Directories 755. Please see one of the many helpful guides on setting proper security permissions in wordpress: codex.wordpress.org/Hardening_WordPress#File_PermissionsEmbolectomy
I've tried creating an upgrade folder and setting it chmod 777 and I'm still getting this problem. The cynic in me thinks the WordPress people make this deliberately difficult so that people will just give up and pay them for one of their managed install subscriptions. I mean it doesn't even tell you the frigging name of the folder!Amberjack
Hi @SimonMorgan. All I can suggest is to ensure you have the upgrade folder in the right location i.e. inside wp-content, try set the permissions via Filezilla and clear your browser cache to ensure the changes have gone through. Also, I have never heard of a paid, 'managed install subscriptions' service ran by WordPress, so it is definitely not them making this deliberately difficult.Amphibology
1+ for perfect ans. facing this issue since long and now its resolved by your ans only. Many thanks!Platina
D
7

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 :)

Doorsill answered 20/2, 2019 at 18:58 Comment(0)
R
4

for nginx people
if you have php-fpm installed you have to tell it that its user and group is nginx. /etc/php-fpm.d/www.conf . find user which is assigned to apache by default and change it to nginx. also do it for group. then run this command :

sudo service php-fpm restart


also inside of your wordpress directory execute these commands

sudo chown nginx:nginx * -R 
sudo usermod -a -G nginx username

change username into what your current username is.

yet you have to apply propper permissions. run these commands inside your wordpress directory

sudo find . -type f -exec chmod 664 {} + 
sudo find . -type d -exec chmod 775 {} +
Replication answered 22/9, 2015 at 21:53 Comment(4)
The chmod is more permissive than standard which is 644/755. Also, may want to add chmod g+s so new files/folders will inherit the owner gid, since you only ad nginx as a secondary group to the user.Unbend
Doing such a large chown, you'd probably have to add yourself to the nginx group, wouldn't you? If say you wanted to replace theme files.Isologous
its about php user to interact with nginx user to serve and response about creating files and other thingsReplication
"... /etc/php-fpm.d/www.conf . find user which is assigned to apache by default and change it to nginx. also do it for group..." How do I do this ? I think my apache default user is www-dataValidate
H
1

If you are using vsftpd as your FTP server and have enabled passive connections, you need to add pasv_promiscuous=YES to /etc/vsftpd/vsftpd.conf.

Honeydew answered 8/12, 2014 at 16:57 Comment(0)
M
0

I was having a similar issue. It started with me trying to update a plugin on a migrated WP install. I didn't get it, all my permissions were EXACTLY the same as the old server. In my situation, I started to see that not much was working properly. I couldn't install/delete plugins or themes as well as uploading media would error out. Then I found the fix via some research.

If you are still having this issue, and changing permissions DID NOT fix the problem try this:

Go in to your hosting control panel and find your hosting settings, wherever you can edit your scripting settings. In Plesk (as in my example), this would be under Websites & Domains. Click on your domain name at the bottom. On the next screen, where it says "PHP support (run as..." change the dropdown from "Apache module" over to "FastCGI application". Everything should be fixed up now!

FastCGI

Magneton answered 15/7, 2014 at 22:2 Comment(0)
H
0

(Re)setting the permissions via ftp didn't make a difference for me either. There is no SSH available, so I had to log in the control panel (directadmin in my case), the File Manager where I could "Reset Owner" to "File ownership reset" the /wp-contents directory.

Histrionism answered 15/1, 2015 at 10:47 Comment(0)
B
0

I'm running Nginx with Wordpress. I deleted the upgrade folder in wp-content and then ran the upgrade from the wordpress GUI again. I noted the linux user for the upgrade folder created was www-data. I then did a {sudo chmod -R www-data:www-data .} Ran the upgrade again from the GUI and it worked.

Probably need to change the permissions on most of the folders so they can't be modified by www-data but I'll figure that out tomorrow.

Bergius answered 2/8, 2015 at 13:5 Comment(0)
C
0

A permission issue, make sure apache (www-data) has write permissions.

Clangor answered 25/6, 2016 at 22:44 Comment(0)
M
0

All the above is great, but I think you missed the simplest issue. Your website is using more space than it has allotted, and therefore it is broke. Wordpress makes more files as is in use. If you are on the margin of going over, a simple overnight issue where you did nothing is possible. Go to bed, everything fine. In the morning website is broke.

I own my websites so I go into the reseller part of Hostmonster or Hostgator (I have sites on both hosting platforms) and I reallocate more space and the problem goes away usually. Try that first, or look into it before messing around with permissions. If you changed a permission and the issue came up, could be permissions, otherwise, check this first.

Mutualism answered 19/6, 2018 at 12:8 Comment(0)
O
0

I had the same issue when I tried to install wp plugin(s). However, I managed to solve the problem with the following command:

sudo wp plugin install [plugin name] --allow-root

Oday answered 20/7, 2021 at 20:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.