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
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
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?
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.
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.
Great ! I’ve been seeking so long to resolve this pb, and this works !!
Thanx a lot, Keith.
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
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.
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?
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.
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?
Sorry, I should have mentioned, I was attempting to upgrade from 2.7.1 to 2.8.4.
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!
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
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.
Many many many thanks for this, I’v been searching for like 2 hours
Thanks Man i problem is gone after 6 hours of headache
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.
Thank you so much!
I’ve had many problems with WordPress FTP Access on Xtreemhost, but this tweak fixes it!
Thanks! =)
Worked for me as well! Needed to change the access right on the includes directory but after that it worked like a charme. Thx
awesome. adding define(‘FS_METHOD’, ‘direct’); fixed my upgrade problem. thanks!
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!
i add it end of the wpconfig.php .. but still the same problem
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
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.
Just had the same problem and this solution worked – which WP made this solution a lot easier to find. Thanks for the help!
Thanks alot, This works 100%!
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!!
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
This worked like a charm. Thanks so much!
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??
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
[...] http://www.kgarner.com/blog/archives/2009/06/13/direct-auto-update-on-wordpress-2-8/ [...]
[...] googling revealed that I needed to add this constant in my wp-config.php [...]
[...] Thanks to Keith for figuring out why WordPress was asking me to log in just to install a new theme. [...]