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');

31 Comments

  1. Posted 6/22/2009 at 8:43 am | Permalink

    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. Posted 7/29/2009 at 11:32 am | Permalink

    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. Posted 7/29/2009 at 11:41 am | Permalink

    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. Brett
    Posted 8/13/2009 at 8:49 am | Permalink

    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. Posted 8/22/2009 at 10:20 am | Permalink

    Great ! I’ve been seeking so long to resolve this pb, and this works !!
    Thanx a lot, Keith.

  6. Posted 8/23/2009 at 5:06 am | Permalink

    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

  7. Posted 8/27/2009 at 12:26 pm | Permalink

    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.

  8. Posted 9/5/2009 at 7:54 pm | Permalink

    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?

  9. Posted 9/5/2009 at 7:57 pm | Permalink

    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.

  10. Posted 9/5/2009 at 8:30 pm | Permalink

    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?

  11. Posted 9/5/2009 at 8:32 pm | Permalink

    Sorry, I should have mentioned, I was attempting to upgrade from 2.7.1 to 2.8.4.

  12. jules
    Posted 10/7/2009 at 5:06 am | Permalink

    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!

  13. Posted 11/5/2009 at 3:43 am | Permalink

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

  14. Posted 12/19/2009 at 9:16 pm | Permalink

    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.

  15. Boris
    Posted 1/8/2010 at 4:12 am | Permalink

    Many many many thanks for this, I’v been searching for like 2 hours

  16. Posted 1/11/2010 at 2:15 pm | Permalink

    Thanks Man i problem is gone after 6 hours of headache

  17. Posted 1/12/2010 at 11:41 am | Permalink

    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.

  18. Ldigital
    Posted 2/6/2010 at 1:04 pm | Permalink

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

  19. rene
    Posted 2/16/2010 at 4:50 am | Permalink

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

  20. jack
    Posted 2/23/2010 at 4:04 pm | Permalink

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

  21. Posted 2/27/2010 at 10:05 am | Permalink

    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!

  22. asantha
    Posted 3/23/2010 at 10:09 pm | Permalink

    i add it end of the wpconfig.php .. but still the same problem

  23. Billy Mac.
    Posted 3/25/2010 at 7:54 pm | Permalink

    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

  24. Reco
    Posted 3/29/2010 at 5:21 am | Permalink

    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.

  25. APerson
    Posted 3/31/2010 at 5:57 pm | Permalink

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

  26. Posted 5/30/2010 at 2:33 am | Permalink

    Thanks alot, This works 100%!

  27. Posted 6/2/2010 at 4:29 am | Permalink

    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!!

  28. Posted 6/10/2010 at 4:53 pm | Permalink

    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

  29. Posted 7/27/2010 at 10:09 am | Permalink

    This worked like a charm. Thanks so much!

  30. Posted 8/5/2010 at 10:39 pm | Permalink

    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??

  31. Posted 8/7/2010 at 6:10 am | Permalink

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

3 Trackbacks

  1. [...] http://www.kgarner.com/blog/archives/2009/06/13/direct-auto-update-on-wordpress-2-8/ [...]

  2. [...] googling revealed that I needed to add this constant in my wp-config.php [...]

  3. [...] Thanks to Keith for figuring out why WordPress was asking me to log in just to install a new theme. [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*