As three of my hosts where going down permanently at more or less the same time, I have spent the last two months on moving my infrastructure to a new host. The host that was serving my blog http://www.gamelinux.org was an outdated Debian Etch (Last update from Debian was on 22 May 2010 – so about time to upgrade!!!). The old wordpress version on Etch was 2.0.10 and the new wordpress shipping with Ubuntu 10.04 Lucid is running 2.9.2. So after a simple mysqldump from my old installation, and importing it to my new installation, wordpress automatically updated the needed things in the DB and things kinda worked OK. I had to change the theme to a default theme before everything was 100%.
But the default theme is kinda dull, and Akismet was complaining about updates that where available, but trying to upgrade or install new themes brought me to a “strange” page (Just new to me) where I had to add FTP/SFTP credentials… Googling it quick told me that this happens if wordpress does not have the permissions on the file system that it wants. It should then try to FTP to the hosts its running on, trying to add the new files that way… Going through search results to find a solution not involving using FTP, kinda scared me… People was changing owner of the whole directory recursively where wordpress was installed. I’m not a fan of such a method, specially when I have installed wordpress using the Ubuntu standard repository. I also can not see a valid reason that wordpress should not be able to install and update stuff based on the permissions in the directory where it is installed!
So, digging into the code on why it choose to try the FTP method and with the intension of forcing it to ignore errors and try to install it on the file system anyways, I see in the file “/usr/share/wordpress/wp-admin/includes/file.php” above the function get_filesystem_method that one can define a override in the configuration file!
* Note that the return value of this function can be overridden in 2 ways
* - By defining FS_METHOD in your
* - By using the filesystem_method filter
* Valid values for these are: 'direct', 'ssh', 'ftpext' or 'ftpsockets'
So I added in my /etc/wordpress/config-www.gamelinux.org.php:
and tried to upgrade Akismet again… TaDa!!! It worked! I tried to install a theme… TaDa!!! It worked!
So I’m adding this as my first post on my newly upgraded wordpress, to hopefully help some others that are annoyed with the fact that there where no real good/usable solutions when googling for the problem.