WordPress Plugin upgrade failed error finally solved

WordPress LogoI have had a many WordPress blogs over the years installed on shared hosting and have had little problem installing and managing them. I used a great auto upgrade plugin before automatic upgrades came to WordPress in version 2.7 (I think). But even with automatic upgrading of versions and plugins, having many blogs, it still took some manageing to make sure all my blogs were up-to-date and secure. So I planned for the what I saw as the Holy Grail of a WordPressMU (now Multisite option) install on a virtual server to combine all (or at least most) of the blogs I manage onto one server therefore one time upgrade of versions and plugins.

For reasons better none to me at the time and partially explained on this post I started from LAMP configured Ubuntu 10.04 server install (my server of choice). After some initial issues problems were solved the WordPress 3.0 with Multi Site install, with the domain mapping plugin appeared to be all configured correctly. Not till slightly later did I find that I could not upgrade the plugins automatically (one of the prime reason for having the WordPressMU configuration). The error message I got was as below but basically it appeared that there was an access/permission issue.

Enabling Maintenance mode…
Updating Plugin Akismet (1/1)

Downloading update from http://downloads.wordpress.org/plugin/akismet.2.4.0.zip…
Unpacking the update…
Installing the latest version…
Removing the old version of the plugin…
Plugin upgrade failed.

An error occured while updating Akismet: Could not remove the old plugin..

After much googling I was still left scratching my head, although there were many forum posts on a similar subject they, for the most part, would go the same way:

  1. WP user complains of not being able to upgrade plugins
  2. Many other WP users chime in with similar issues
  3. A helpful soul says its not a problem just set every file and folder (and the kitchen sink) to have permissions of 777 (read, write and execute access for everybody and his passing dog)
  4. Then a very sensible WP user advises this is incredibly fool-hardy and insecure and you should never do this
  5. Finally the forum posts end without any real answer

I did temporarily set all folders to 777 to see if this would solve the problem and it had no effect for me what so ever. What did initially appear to be the issue was that my virtual server did not have FTP access as nearly all shared hosting has. But by following this very useful blog post from LornaJane I knew this was not the issue and completely agreed that I did not want to have an FTP server (another vulnerability) if I did not need to.

I was getting closer to my answer in the post and comments from LornaJane with the command to make the apache user be able write to the WordPress directory as follows:

chown -R apache:apache

But wait, as the my default Ubuntu server does not use the user/group apache but instead uses www-data the command I finally used via ssh on my remote server was:

chown -R www-data:www-data /var/www

And as if by magic my auto upgrades worked. Hopefully this may help someone else as well.

WordPress Permalinks not working on Ubuntu 10.04 – mod_rewrite issue requires a symlink

Ubuntu & WordPressI recently installed WordPressMU on a virtual server and had problem with the permalinks. Much Google searching followed with little success at first but after some persistence I found the answers I needed.

I will try and write this up for three reasons:

  1. So hopefully it could benefit someone else with the same problem
  2. To try and better understand it myself
  3. I will no doubt forget for next time and need to refer back.

The bulk of this post is taken from a fantastic post on the Drupal site (http://drupal.org/node/332318). Although I had done lots of Google searches I struggled to find the answer for quite some time until I hit the post above. I think this is because the key to finding the right answer for a problem is finding someone with the same set-up. Saying this I found the solution to my WordPress problem on Drupal site although the issue was with a common problem area of ‘mod_rewrite’ on the Apache web server and in particular the Apache server running on Ubuntu. Ubuntu has a different way of storing apache settings (e.g it has a blank htppd.conf and uses apache2.conf) and holds modules in an ‘enabled’ folder not in the main settings file. This may well be better way than the ‘other’ ways but it can mean that a lot of the mod_rewrite ‘solutions’ on Google are not relevant if they are not specifically for Ubuntu.

Just quickly for this project my setup was:

Virtual Server Provider: VPS.net

Base install: Ubuntu 10.04 (Lucid) x64 LAMP*

WordPress 3.0 (with Multisite enabled)

* This was a preconfigured Ubuntu server with LAMP already instated and my experience may have been different if I had taken a clean Ubuntu install and installed LAMP myself. VPS.net do a offer a fully preconfigured WordPress server in Ubuntu which I am sure would have not had these issues but I wanted to install WordPressMU and this requires the install to be on the www root (VPS.net install it on a folder called WordPress) and the latest version. In my way of thinking I would prefer to install from scratch on a clean webserver than upgrading/moving an existing install – OK I like to learn the hardway.

Anyway the solution to my problem:

1. First we need to check if the rewrite module is installed. I was connected to my VPS server via SSH but either in a Terminal or via SSH type (or copy from below):

apache2ctl -M

This should show a list of Apache modules. Rewrite_Module should be there (as it is a default in Ubuntu 10.04) but if not check with your FTP client or in your file browser that /etc/apache2/mods-available contains a file called rewrite.load. If it does not then you need to fix this before you can carry on.

Presuming it does exist then we need to create a symlink (Symbolic Link on Wikipedia) between mods-enabled to mods-available. Again in the Terminal/SSH type or copy:

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/rewrite.load

2. Now we need to check that rewrite module rewrite.load is in the mods enabled folder (/etc/apache2/mods-enabled). The easiest way is to have a look at that folder with your FTP client or file browser.

3. Presuming you are still OK then then the final and very important stage is to ‘Enable AllowOverride All’

In the folder /etc/apache2/sites-enabled you should find a file called 000-default and you need to check that all permissions are set to read & write not just read only, easily done with an FTP client (right click file>File Permissions in Filezilla)

In 000-default it will probably say AllowOverride None in several places. Find the one for where you’ve installed WordPress , and change it to AllowOverride All. e.g if WordPress is installed at var/www/????? then it may be under the Directory “/var/www” grouping.

Finally, dont forget to restart Apache from the terminal:

/etc/init.d/apache2 restart

(now corrected see Keith’s comment)

if you don’t restart none of the changes will take affect

That worked for me and hopefully will work for somebody else. A big thanks to the Drupal site for the post but I thought it was worth regurgitating for WordPress users as I am sure it could affect a few.

Ubuntu 9.04 is released

Ubuntu 9.04I have been meaning to write a post for the new StaffsLug (Staffordshire Linux User Group) website for sometime. I had intended. for my first post. to write a bit on the UK Governments ‘Open Source, Open Standards and re-use Action plan‘ but this will have to come later. As this week saw the release of the latest version of the ever popular Ubuntu 9.04 I thought it important that the Staffslug website had a post, so I wrote the post below which can be found on the site itself here.

This week saw 100’s of release parties for arrival of the latest version of Ubuntu Linux. Code named Jaunty Jackalope Ubuntu 9.04 (9 for 2009 and 04 for April) has arrived on time based on Canonical’s 6 monthly release cycle. Ubuntu 9.04 is not an LTS (Long Term Support) edition so will get 18 months of free updates (LTS receive 2 years free updates and are generally thought to be more stable). As ever, work has already started on the next version 9.10 code named Karmic Koala with the next LTS version being 10.04 to be released in April 2010.

9.04 Ubuntu does not contain any radical changes, as is often the way with a 6 monthly cycle, but does finally include OpenOffice.org 3.0 and also promises faster boot time. Other improvements come from updates to Gnome (the default Ubuntu desktop) and application updates like Evolution (Ubuntu’s  Outlook equivalent) which now comes with exchange server compatibility.

As well as the Gnome Desktop default 9.04 there is also Kubuntu 9.04 with KDE desktop,  Xubuntu 9.04 with XFCE desktop, Ubuntu Server Edition 9.04 with no graphical user interface and the new Ubuntu Netbook remix 9.04 designed for netbooks like the Asus eee’s and the Acer Aspires.