WordPress Automatic Updates broken, asks for Connection Information – fixed!

Posted in doh , Linux

Automatic updates of plugins and wordpress itself does not work with lighttpd out of the box. No matter how much I searched for an answer to why this was happening, I couldn’t seem to find anyone that addressed the problem and came up with a solution. I wanted to fix the WordPress plugin Automatic Updates asking for Connection Information problem, but most people are using generic shared hosting with no real access to their server. And a large chunk of those users are on windows or using apache so that’s no help to me. Some people are doing more harm than good telling everyone to go change their file permissions to 777 or chown all the files to the web server user. But… I… finally… figured… it… out! To start with, here are some dead-end answers that you will find searching out there in the wastelands:

Things that are not the problem

needing to deactivate plugins before upgrading
file/directory permission problems
missing modules from lighttpd.conf
php memory issues

The real problem is a php function called getmyuid() which “Gets PHP script owner’s UID”. Ok, so permissions and ownership may still be an issue for you, and you may not even have the right temp directory set up that file.php is looking for, but if everything else is correct, go edit wp-admin/includes/file.php and change the getmyuid() call to posix_getuid() instead. You can expect to have access to the functions, but to avoid any warnings or errors it checks if the functions are callable first, so you may as well change that one too. See below for the detailed change:

function get_filesystem_method($args = array()) {
        $method = false;
        if( function_exists('posix_getuid') && function_exists('fileowner') ){
                $temp_file = wp_tempnam();
                if ( posix_getuid() == fileowner($temp_file) )
                        $method = 'direct';

After that simple change, my updates starting working just fine.

Upgrade Plugin
Downloading update from http://downloads.wordpress.org/plugin/rootninja-plugin-1.2.3.zip
Unpacking the update
Deactivating the plugin
Removing the old version of the plugin
Installing the latest version
Plugin upgraded successfully
Attempting reactivation of the plugin
Plugin reactivated successfully.

Ahhhh much better. No more asking me to fill in Connection Information for some silly ftp manual update blah.

Posted by admica   @   6 August 2009

Related Posts

4 Comments

Comments
Jun 26, 2010
1:25 pm

Brilliant. I’ve been trying to figure that out on my dev machine for ages. Thanks.

May 24, 2011
7:26 am
#2 jesse :

wow okay that worked very well. thank you very much for sharing.

Trackbacks to this post.
Leave a Comment

Name

Email

Website

*

Previous Post
«
Next Post
»
Powered by Wordpress   |   Lunated designed by ZenVerse

Valid XHTML 1.0 Transitional