WordPress plugin installation or update error in admin interface? SOLVED!

I’ve just resolved this issue (again) so thought I’d document it so that others can help themselves too.

When trying to update my WordPress plugins I was getting an error telling me that the existing plugins could not be updated due to a permissions error. New plugins also couldn’t be installed.

There are a couple of options which can help resolve this. Do each in turn and try again as the problem may be resolved without doing ALL of them. And I think it’s sensible to minimise the manual changes we make to our site’s files.

All below assume you have SSH access to your WordPress host. So SSH into your server and proceed…

1. Add/edit line in wp-config.php

This one helped me after I initially installed WordPress and I was unable to install ANY plugins from the web interface. Adding this line effectively tells WordPress that you want to be able to install plugins directly from the filesystem (instead of ssh, ftp, ftpsockets, etc.) so that when you install plugins the web interface will download them to your server filesystem then install them.
It also allows you to upload any plugin files via ftp/sftp/scp and then install then through the web interface.

wp-config.php is in the root of our WordPress installation. First make a copy of the file on the off chance that you break something.
cp wp-config.php wp-config.php.bak

Then open in nano (or vi if you’d prefer but you can google the keyboard shortcuts for vi yourself if you’re using it).
nano wp-config.php

Add or edit the line that refers to ‘FS_METHOD’ to match:
define(‘FS_METHOD’, ‘direct’);

2. Fix file groups

Depending on your WordPress host, the majority of the WordPress files will be owned by a system user and group, often called WordPress, or web, or something else. We first need to know what group name your host is using. So in your WordPress root run:
ls -al

The output from this command will look something like:

Showing all the files including owner and group. Look for the system group which owns most of the files. The group is in the 4th column, web in this case.

We then want to make sure all the files and folders in the plugins directory are ‘members’ of this group.
chgrp -R web wp-content/plugins/

This usually fixes my plugin permissions error and I don’t often have to do the next steps.

3. Fix file and folder permissions

Sometimes the file and folder permissions in the plugins directory get changed. No idea why. So we’ll reset them to the default permissions which should allow the web interface to update them if needed. These commands assume you’re running them from the WordPress root folder.
If you want to know more about Linux file permissions and what the 664 and 775 below mean then have a read here.

Update the file permissions to 664 (rw-rw-r--):
find wp-content/plugins/ -type f -exec chmod 664 {} \;

Update the directory permissions to 775 (rwxrwxr-x):
find wp-content/plugins/ -type d -exec chmod 775 {} \;

Leave a Reply

(email optional)