Cant Update plugins or theme (wordpress)

Posted August 10, 2015 12.5k views

whenever i try to update any plugin that comes as bundled with my theme i cant update. it says

update failed 
cant remove previous/old data

or sometime it says cant delete “plugins folder name”. same this happens when i try to update my theme from envato theme update plugin. my theme is purchased from envato.

but when i try to update any plugin which i downloaded separately, ex. yoast seo, it updates without any problem.

does anyone faced similar issue?

What im using is
Wordpress 4.2.4
Nginx 1.8
PHP 5.5

thanks in advance.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

Thats about permission.

First define this on your wp-config.php and see if it solves:
define(‘FS_METHOD’, 'direct’);

If not you have to take ownership of the whole site directory.
Let’s suppose your install is on /var/www/html and your site user operator is fatorbinario so you can type these:

sudo chown -R fatorbinario:www-data /var/www/html
sudo chmod -R g+w /var/www/html
sudo find /var/www/html -type d -exec chmod g+s {} +

*Make a backup first.

  • Hi @fatorXb2

    your above solution solved my previous problem, thanks for that.

    but after running those commands now im having a problem with my ftp uploader(filezilla). now i cant upload any file with overwrite. if i try i get this msg

    Error:  /var/www/html/wp-content/themes/filename.php: open for write: permission denied
    Error:  File transfer failed

    so i had to edit from putty. but filezilla was working without any problem before. i think something changed after setting the permission parameter.

A few possible causes of this type of error are 1) incorrect ownership or permissions on the wp-content directory or its contents, and 2) running out of disk space. There certainly could be other causes. So, check permissions and disk space first to see if either of those are the cause of the problem.

  • Hi @jsamuel

    thanks for your quick response.

    File permission for wp-content is set to 755. also same for directories inside. once i thought i should change them all to 777 but is it safe? please advice me.

    i got another space(nearly 15GB) free for my droplet.

  • Hi @newbie

    It’s generally not a good idea to change permissions to 777. The right approach is instead to make sure that the user your PHP scripts run as is also the user that owns the files and directories. That way, the 755 permissions on a directory are all PHP needs to write files there (the first number there is the permission of the owner, where “7” means all permissions including write permission).

    Sometimes the ownership of files and directories can be different from the user PHP runs as if you uploaded files as a different user than PHP runs as. If that’s the case, you should try to remember to fix file ownership after you upload any file to your server.