
WordPress auto download/install is a very nice feature, but sometimes a few problems can appear. One of them is that WordPress don’t manage to download the new version. This happens on slow servers. Here is how to solve it.

WordPress auto download/install is a very nice feature, but sometimes a few problems can appear. One of them is that WordPress don’t manage to download the new version. This happens on slow servers. Here is how to solve it.
To apply this hack, you'll have to edit one of WordPress core files. Keep in mind that it is never recommended. This hack should be applied only if you have problems while auto-upgrading WordPress.
Open the wp-admin/includes/files.php file and go to line 448. You'll see the following:
$response = wp_remote_get($url, array('timeout' => 60));
To allow more downloading time, simply change the 60 with a greater value, as for example:
$response = wp_remote_get($url, array('timeout' => 120));
16 Responses
Hmm. I wonder why this couldn’t be overridden by calling the change in your functions.php and avoid changing the core files?
What are symptoms that this is the reason?
There are indeed plenty of things that could go wrong. Last time upgrade was failing for me because WP run out of memory while at it. Got it by error log.
Changing core files is never an option, actually.
I haven’t tried this yet though it would be best practice if one could either update functions.php or create a plugin to do this.
One question I do have is do you know if you if alternatively you could update the actual php.ini settings file via php’s ini_set(‘max_execution_time’,120)? If you could do this then just add it to your functions.php file; I haven’t look into if it’s possible yet but if someone has the time to check it out then let us know.
I looked at code properly. Function this fix is for uses some deprecated stuff (Snoopy class) and marked as in need of change to WP HTTP API.
So not much sense in inventing workarounds for it, at least not until code update.
Scratch my previous comment.
Function was updated, I got confused by outdated developer’s comment on it.
Great job.
What are the cons of this workaround? Is it safe?
I have been working on a WP site that is on a diff host than usual and I can’t get it to upgrade the core, only the plugins.
I have tried upping the memory like in this post http://digwp.com/2009/06/wordpress-configuration-tricks/ still says “installation failed.”
That it will automatically upgrade plugins just fine may mean it is just a size issue, any ideas or alternative fixes?
this is interesting! but i nowadays nobody needs this i think….
60 seconds are enough..
my opinion
I found this fantastic piece of code.
Since I am storing one of my WP blogs abroad , I was having resopns tome problems. Yur solutiond helped me to solve that problem.
Trackbacks: