Fix Automatic Plugin Update

I recently moved from a MediaTemple Grid Server to a MediaTemple DV extreme, and in that move, I lost the ability to do automatic plugin updates, and it instead required me to enter my FTP info.

As I use a gigantic amount of plugins, that becomes annoying very soon. So I decided to find out what the issue is. Turns out that I’m having the same issue as the guy who filed this bug was. Filesystem access is available, the files are owned by me, but the webserver doesn’t run as me, and thus, WordPress doesn’t detect the automatic update correcly.

There’s a patch in there that makes it work, but might cause issues for some other users. Luckily, DD32 proposed a solution in the last comment: a plugin that makes sure “direct” is returned as the filesystem_method.

So until this issue is fixed in WordPress core, you can download and install this plugin. After which, you can auto update all your other plugins with ease, as long as filesystem access is available.

Please note: I give no guarantees here, and please, if you don’t get this to work, disable the plugin and call your host, not me. There’s two few things you need to check:

  1. Make sure the wp-content/plugins/ directory and all the files in it are writable for the webserver.
  2. Make sure the wp-content/upgrade/ directory exists, and is writable by the webserver.

Update: I ended up switching hosts over issues like this one. I’m now on WestHost, and all seems to be good. More info on my WordPress hosting experiences here.

Update #2: Putting this in your wp-config.php will help in most cases without needing the plugin:

define(‘FS_METHOD’, ‘direct’);

Tags:


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

44 Responses

  1. Erik ReaganBy Erik Reagan on 7 February, 2009

    Excellent! I’ve been on a DV setup for about 6 months and was never really motivated enough to hunt down the issue causing the auto upgrade problem. Thanks for the post and reference!

  2. Chung Bey LuenBy Chung Bey Luen on 7 February, 2009

    I didn’t notice WordPress has such issue. But I will take take note about the problem in future if I move my server. Thanks for sharing.

  3. EtherealmindBy Etherealmind on 7 February, 2009

    I have been really unhappy with how long Mediatemple are taking to fix the storage problems on their GS product. It has been more than than six months of constant outages and service losses while they resolve various problems with their GS service.

    Since GS is a type of Cloud Computing, it is not inspiring. More importantly, will Mediatemple ever get their GS service to work?

  4. SeiferTimBy SeiferTim on 7 February, 2009

    Thanks! This has been a thorn in my side since the feature was implemented! I hope this fixes it… :)

  5. Kevin BossBy Kevin Boss on 7 February, 2009

    Wow this is exactly what I was looking for about 2 weeks ago – thanks!

  6. AustinBy Austin on 7 February, 2009

    Awesome plugin! I wish that there was a plugin that would allow sftp connections though :C I use SSH but not FTP.

  7. Chris in CincinnatiBy Chris in Cincinnati on 7 February, 2009

    Outstanding. I just upgraded from (gs) to (dv) as well and was wondering what was up with this.

    Thanks.

  8. JimBy Jim on 7 February, 2009

    I upgrade from a (dv) Rage to a (dv) Extreme recently, but I’ve been on MediaTemple since last summer, and the auto update has always asked for my FTP credentials. I tried using this plugin to rectify the problem, but it just comes back with the ‘cannot remove old plugin’. Any idea why that might be and what I’d have to do to fix it?

  9. DD32By DD32 on 8 February, 2009

    Just like to make it clear: This is not a bug.

    If the files are owned by a user other than the webserver, Then under most web server setups, Having the webserver modify the files, can cause issues, Mainly, The user being unable to delete any files the webserver touches from your home directory.

    The reason that the error “cannot remove old plugin” comes up, Is exactly due the the above, If the webserver cannot modify the files (Which it shouldnt be able to if they’re not owned by the webserver), Then its going to be unable to delete them, IF you install a new plugin, then instead of the Webserver not being able to delete it, YOU will not be able to delete it.

    So its NOT A bug, Mearly making it work nicely for Everyone. If It cannot modify the filesystem directly, It reverts to using FTP. If you have the PHP SSH extension installed, You can upgrade via SSH2 instead of FTP if you wish.

  10. RarstBy Rarst on 8 February, 2009

    I didn’t even know it is possible in other than FTP way. :) However solution didn’t work for me – I had to change bunch of permissions but in the end upgrade nuked old version of plugin and failed to install new one. My host I guess, back to FTP way.

    • Joost de ValkBy Joost de Valk on 8 February, 2009

      So it was able to delete the old directory? Did it have write access to the wp-content/plugins dir itself? Perhaps it couldn’t create the new dir for the new plugin.

      • RarstBy Rarst on 8 February, 2009

        There were different errors as I started with permissions for wp-content and moved down, retrying upgrade after each permission modification. It was able to kill old version in the end, I think it should have had enough rights to create folder because I started changing permissions from top so wp-content was 775 by then.

  11. Ricky CBy Ricky C on 8 February, 2009

    Hi
    I just check all your plugin, they are all worth to try, Good Job! I’m looking forward for your next updates

  12. Kevin BossBy Kevin Boss on 8 February, 2009

    Yeah same outcome as Rarst.

  13. da shaikhBy da shaikh on 8 February, 2009

    its mind blowing mannn….
    i was very much concerned about my websites jokking.com and eblything.com which is about to launch.
    your plugins have really called my hearts and inspire me towards your works….

  14. Chris CoyierBy Chris Coyier on 8 February, 2009

    This is huge. I too am on (dv) and cannot auto-upgrade plugins. I have this installed now, but don’t have any plugins out of date. As soon as one comes up I’ll test it and let you know.

    I’m having some other weirdnesses since switching to (dv) as well.

    1) Posts don’t auto-save as a write them like the used to.
    2) I can’t schedule posts to be published later. The time will come and go and the post will then say “Missed Schedule” instead of just publishing.

    Ideas?

    • Charles SimmonsBy Charles Simmons on 10 February, 2009

      @ Chris Coyier

      The posts scheduling issue is usually related to wp-cron.php. Open your /etc/hosts file and make sure that the IP address listed is yours.

  15. BartBy Bart on 9 February, 2009

    Just to be sure…
    You mention:
    “Make sure the wp-content/plugins/ directory and all the files in it are writable for the webserver. Make sure the wp-content/upgrade/ directory exists, and is writable by the webserver. ”

    What attributes should you have on the plugin and upgrade folder? 775, 777 or something different?
    Should you apply this for al the subfolders also?

    • NicolasBy Nicolas on 11 February, 2009

      I was curious too. I’m having all sorts of issues with upgrading the plugins and such.

  16. NeilBy Neil on 9 February, 2009

    I was using the automatic upgrade plugin on a free hosting service and it always required my FTP login details. After switching to a paid host it begun to work correctly.

    I was wondering what was causing the problem but this has helped to clarify things.

  17. Chris AbernethyBy Chris Abernethy on 11 February, 2009

    Joost, I recently posted an article on this same issue with a few more details on the specifics of why it occurs: http://www.chrisabernethy.com/why-wordpress-asks-connection-info/ In my case, I was having the problem on one of my local, firewalled development servers, so the easy fix was to chown -R apache: the WordPress installation. Your situation is a bit more difficult, as it doesn’t sound likely that you can change the ownership of plugin-install.php to the system user running apache.

  18. Gustavo LeigBy Gustavo Leig on 11 February, 2009

    Hi,

    can I ask you why you decided to move to a dv? more capacity or just the gs problems (Im now with a gs)? Did you get better perfomance after moving? Also, if you have any tip on moving from a gs to a dv, this should be a goog article in future.

    anyway

    thanks for the tip.

    • Joost de ValkBy Joost de Valk on 11 February, 2009

      I needed more performance, the performance increase was huge. On the move itself: that was done for me by MT’s managed care team, so can’t really write an article about that ;)

    • Chris CoyierBy Chris Coyier on 11 February, 2009

      So the 2.7.1 upgrade is out, and it looks like if this plugin thing is an issue for you, this automatic upgrade is going to be too. Can the plugins ideas be expanded to allow for this as well?

      • Joost de ValkBy Joost de Valk on 15 February, 2009

        Hi Chris, just make sure the whole wordpress directory is writable by the webserver, and this’ll work as well!

  19. MiladBy Milad on 12 February, 2009

    wow! works like it is tamed to!
    big thanks man…
    if u ever come to Iran, call me and i’ll treat u some good food!

  20. KimCBy KimC on 13 February, 2009

    I watched your seo video and love what you do with your plugins – but why aren’t most of them available at wordpress.org? Wouldn’t this make auto updates a no-brainer and give you, the author, instant street credit?

    • Joost de ValkBy Joost de Valk on 15 February, 2009

      Hey Kim, 95% of my plugins actually ARE on wordpress.org, that’s why I’m among the 10 plugin authors with the most plugin downloads :)

  21. KimCBy KimC on 15 February, 2009

    My mistake – that’s good to know. I searched by author name and only found one…maybe your name is listed differently on different plugins…

  22. AlexBy Alex on 19 February, 2009

    Thank for this fine plugin (and Tweetbacks, too!)!

    If you enhance the plugin with automatic update of the core and themes, this would be great. I have tested WP 2.7.1 with Autoupdate (both, FTP, too), but it doesn’t work, i tried changing the permissions, tried to place it under the WWW-Root, maybe WP doesn’t like FTP Server like “fdfdfdf.abc.de”. PS: The Upgrade-Dir in wp-content is writeable.

  23. Jonah KorbesBy Jonah Korbes on 29 May, 2009

    Works perfectly for WPMU. Thanks very much.

  24. BeauBy Beau on 11 June, 2009

    Thanks so much! I’d been beating my head against the wall trying to figure this out for weeks. This worked like a charm. Much appreciated.

  25. Peter OlleBy Peter Olle on 20 July, 2009

    Maybe not in time to solve your problem Joost, but for everyone with the automatic plugin update FTP problem in mediatemple or other host, just add the data to your config file in wordpress.


    // ** FTP SETTINGS FOR AUTO-UPDATE ** //
    define('FTP_HOST', 'localhost');
    define('FTP_USER', 'user');
    define('FTP_PASS', 'pass');

    With that everything will work smoothly. Hope it helps.

    • RarstBy Rarst on 20 July, 2009

      Thank you, tried this just now with WP 2.8.2 upgrade and it worked perfectly. Only had to add password line, WP remembers host and login for upgrades.

  26. LukeBy Luke on 27 July, 2009

    That worked a treat. Thanks!

  27. GuibBy Guib on 30 November, 2009

    Many thanks fot that plugin who saved me a lot of time since I moved to another server !

Trackbacks

  1. [...] sa am acest feature si sa nu il pot folosi, asa ca am apelat la batranul Google. Si am gasit acest link care rezolva problema: nu mai ai nevoie de datele FTP, totul este facut prin WP Filesystem. Dar [...]

  2. [...] WordPress Issue Hi, I'm having an issue – and support is having difficultly understanding what I mean so i'm going to post it here: domain registered: echowebsites.com.au The issue is related to installing a plugin within wordpress. Normally when you try to do this – you click install plugin – and it installs. However sometimes there is an issue with the permissions set BY THE HOST during the installation of wordpress that causes it to think that it doesn't have ownership of the files. If this happens – it asks for FTP details each time you try and install/remove any plugin. I've found that using cpanel and the fantastico script causes this to happen on our domains with aussiehost. Trying to explain this to support has been a battle! Instructions to replicate: 1) Login to control panel 2) Go here: http://xxx.com.au:2082/frontend/x3/fantastico/index.php 3) Select wordpress 4) Install a new wordpress – put in under a test directory e.g. test http://xxx.com.au:2082/frontend/x3/f…lwordpress.php 5) give it a username and password 6) Go to the admin area of the newly installed wordpress = wp-admin 7) Go to Plugins 8) Try and install ANY plugin 8) When you try and install a plugin – it goes to the error page asking for the ftp details -this is BECAUSE OF WRONG PERMISSIONS ON THE HOST. It should install a plugin automatically and not show this ftp page in wordpress. Now – this might be specific to our domain – but this happens if we install a new wordpress installation each and everytime – on both domains we have registered with you guys. There is plenty of information below explaining that the host needs to check this – please can you guys help me as we have 5 wordpress client sites to build and we can't until this has been fixed – thanks in advance. Please read here for more info here: Why WordPress Asks for Connection Info : Chris Abernethy . com Fix Automatic Plugin Update – Yoast – Tweaking Websites [...]