Direct plugin auto-update on WordPress 2.8

I get a lot of traffic on the site due to my post on getting direct (non-FTP) updates to work on WordPress 2.5.  This method worked up until 2.7.x.  With 2.8 out this week, I found during my svn switch a conflict was created due to a code change in file.php.  Looking at the changes, it looks like the wordpress developers created an easy way for one to short-circuit the update to use the method you want via a setting in wp-config.php.

So, in brief, the permissions and WP_TEMP_DIR settings from the older article still stand.  However, you no longer need to edit wp-admin/includes/file.php. Now you just need to edit your wp-config.php and add the following towards the bottom:

define('FS_METHOD', 'direct');

51 thoughts on “Direct plugin auto-update on WordPress 2.8”

  1. Thanks Keith,

    You wouldn’t believe my head scratching – then I remembered I’d bookmarked your original method for future reference and, sure enough, problem solved with this new (and ridiculously simple) fix.

    Thanks so much 🙂

    Rob Scott

  2. I’m having this same problem… the config.php fix “worked” in that it no longer gave me the “connection information” blank fields to fill in… it says it downloaded the package, unpacked the package… then could not create the directory.

    Any ideas?

  3. Heather, it sounds like permissions on your plugins or temp directory. Based on it being so late in the process, I’d look at plugins first.

  4. Thank you, thank you, thank you!

    I had to bump the memory allocation of PHP in /etc/php5/apache2/php.ini (Ubuntu) to get it to work.

  5. Hello!
    Thanks a lot for this post! It works perfectly on the WP upgrade. But plugin updates still give me the “connection info” fields.

    Any ideas?
    best regards Johan

  6. Huh, works for the upgrade but not the plugins? Sounds like a permissions issue still somewhere. I’ve never tried it for the upgrade, as I just use svn for that.

  7. Having followed the instructions on the 2.8.4 installation on CentOS Linux, I found that the only way I could both get past the final stages of having directories created and the old plugin removed was to:

    chmod -R 777 wp-content/tmp
    chmod -R 777 wp-content/plugins
    chmod -R 777 wp-content/upgrade

    … is there a more secure way to achieve this?

  8. I did try a bunch of other things, including 775 on those directories, but nothing else got it all the way.

    BTW, thank you very much for writing this up, it is insanely useful, I only wish WordPress worked like this out of the box.

  9. I had the opportunity to try a core upgrade too but got this error:

    Warning: copy(/home/lonesc/public_html/wp-admin/includes/update-core.php) [function.copy]: failed to open stream: Permission denied in /home/lonesc/public_html/wp-admin/includes/class-wp-filesystem-direct.php on line 122

    … so, I guessing that there is some other folder that I need to 777 in order to get core upgrades working.

    Is anyone familiar with what folders WP copies from and writes to during a core upgrade?

  10. Just adding the above code to my wp-config.php worked for me (without wp_temp_dir settings). Before, I had been prompted by an ftp error message (re. connection information) when installing new themes in WP 2.8.4. No matter what I tried, it just didn’t work. I tried downloading plugins too and everything seems to run smoothly now. Thanks a lot!

  11. Me again! Just moved one of our bigger blogs to a new bigger dedicated server, encountering a new OS, and a new control panel (Plesk 9.2.2) – I love these learning curves. Got everything set up, then auto updates didn’t work. Came back to this bookmark, still nothing. Turned out to be the following:

    Turn PHP Safe Mode Off

    Simple as that. Hope this helps someone having the major fit I narrowly avoided this morning!

    Once again thanks for your simple guide – really helps to have a step-by-step to go back to when your brain is fried after a day of tinkering 🙂

  12. hi, thanks a million.
    head aching from using ftp past two weeks, today decided either I get auto upgrades working, or chuck WP. given new 2.9 in stream, and over 9 plugins begging for upgrade — was about to give up till I came across this.
    Did the change, immediately “deleted” a plugin without resorting to ftp — I’ll cross fingers for it working across the board, but THAT is one huge step from before.
    Who’da thunk, one liner. And I’ve been tackling file permissions, and considering workarounds for a bit now.
    Gee, thanks, really muchly.
    thanks.

  13. Neat trick. I won’t leave this change in place because it’s not durable through upgrades. But it did help me to diagnose and resolve the underlying problem. Thanks.

  14. Thank you so much!
    I’ve had many problems with WordPress FTP Access on Xtreemhost, but this tweak fixes it!
    Thanks! =)

  15. Worked for me as well! Needed to change the access right on the includes directory but after that it worked like a charme. Thx 🙂

  16. awesome. adding define(‘FS_METHOD’, ‘direct’); fixed my upgrade problem. thanks!

  17. I’ve just installed WordPress (2.9.2) on my localhost and couldn’t install any new themes. Added this to my config and now it works fine. Thanks!

  18. Thanks!
    I too had been pulling my hair out over this. Works perfectly now and just as it always used to (& like it should out of the box), and finally I too was able to update several plugins begging to be updated for quite awhile now.

    (Lol…The hours of head-aches…and then a 15 second fix)

    I had been doing it manually initially but it quickly grew old as you can imagine.
    Again thank-you very much…You’ve saved myself and many people it looks like from further head-aches and almost certain termination of WordPress 2.9.2 🙂
    Lol…just can’t believe how simple that was

  19. I don’t know why but it doesn’t work for me
    when I gave this command at the end of wp-config.php file, I still get the connection information page and I get to see this command in header above the wp template.

  20. Just had the same problem and this solution worked – which WP made this solution a lot easier to find. Thanks for the help!

  21. Couldn’t change anything on my site, only by ftp, but with this little modification and a few permission changes, wordpress is perfect! thanks a lot Keith!!

  22. It worked for me. Thanks very much. I beat my head on the wall for a couple of weeks. Tried everything to no avail. Copied your code and pasted at the bottom of wp-config.

    I O U
    Thanks JB

  23. Hey there, tried the fix and this is the error that comes up when trying to use it:

    ‘Warning: touch() [function.touch]: Unable to create file D:\Hosting\6474687\html/wp-content/constructor.tmp because Permission denied in D:\Hosting\6474687\html\wp-admin\includes\file.php on line 199
    Download failed. Could not create Temporary file.’

    Any ideas as to why??

  24. Malee,

    I’m not really much of a windows guy, but that looks clearly like a permissions problem. Looks like you’re web server doesn’t have permission to write into those directories. Fix that and you’ll be golden. (Of course, if you’re using a hosting provider, you might not be able to do fix it.)

  25. Thanks for this little piece of code, it saved me a few more white hairs while trying to untangle this non-ftp installation.
    Bryan
    🙂 +1

  26. Hello Keith, thank you so much, it still works in WordPress 3.1!

    Kind regards,
    Peter

  27. I tried this option trying to upgrade to version 3.1.2 and it removed the need for FTP information, it just changed the error to being this now:

    Downloading update from http://wordpress.org/wordpress-3.1.2.zip…
    Unpacking the update…
    Could not create directory.: /homepages/18/d109531826/htdocs/blog/wp-content/upgrade/wordpress-3.tmp
    Installation Failed

    And looking at it, im confused cause i was sure in the past my htdocs folder was called httpdocs but not sure and through FTP I cant go that far up in the directory structure to test and see. Im using 1And1.com Hosting.

    Any help with figuring out why? I set the upgrade directory to 777 abut still nothing.

  28. Just manually added the directory and now this is the error I get when trying to update:

    Downloading update from http://wordpress.org/wordpress-3.1.2.zip…
    Warning: touch() [function.touch]: Unable to create file /homepages/18/d109531826/htdocs/blog/wp-content/wordpress-3.tmp because Disk quota exceeded in /homepages/18/d109531826/htdocs/blog/wp-admin/includes/file.php on line 213
    Download failed.: Could not create Temporary file.
    Installation Failed

  29. Damien, it sounds like you’ve exceeded the quota at your ISP. No permission is gonna fix that. You need to delete something or beg your ISP for more.

  30. I love you Keith…you solved the worst problem ever I faced…I fate it when it was asking for the three fields…but you solved my problem…
    Very nice post!!!

Leave a Reply