Posts Tagged ‘WordPress upgrade’

Notes on upgrading to WordPress 3.0 on 1and1

Tuesday, June 22nd, 2010

Normally I’d wait until at least the x.01 release of a new WordPress before upgrading. But this time I wanted to try the new WordPress soon after the final 3.0 version was out. I still waited a few days before installing it to let other people discover and fix any initial problems.

Problems and fixes

My wait paid off as a number of people who were using the same hosting company as me (1and1) found that the upgrade was failing with a ‘Fatal error: Allowed memory size of xxxxxxxx bytes exhausted’.

The fix for this problem is very simple – increase the allowed memory size, either by adding a php.ini , updating the wp-config.php, or for those who could wait a few days for an easier fix, by installing the Memory Bump plugin.

I installed Memory Bump, and went through all my usual WordPress backup steps, before attempting the install.

I pressed the Upgrade button, WordPress did something for about a minute and then I got this error message:

Downloading update from http://wordpress.org/wordpress-3.0.zip.
Download failed.: Operation timed out after 60 seconds with 1023460
bytes received
Installation Failed

Not to panic though, this error is just saying that WordPress didn’t manage to download the new install package before its 60 second timeout. I pressed the button again, and this time it worked!

Downloading update from http://wordpress.org/wordpress-3.0.zip.
Unpacking the update.
Verifying the unpacked files…
Installing the latest version…
Upgrading database…
WordPress upgraded successfully

New themes

The reason I wanted to upgrade as soon as possible was so that I could give reviewmylife a new theme. The old Kubrick theme was getting a bit old.

old reviewmylife blog

After a bit of searching and experimenting I found the News Magazine Theme 640 which I have now switched to.

new reviewmylife blog

One word of advice if you are switching themes – if you swap to a new one, and then back to the previous you might find that all your widgets have been set to inactive. You’ll have to re-add them again.

A second piece of advice is to keep any caching plugin you might have disabled whilst you play about with new themes and theme settings. This will make sure that you always see the latest generated pages, and not older cached ones. Don’t forget to turn the caching back on afterwards!

A later error

Whilst modifying one of my plugins I got this error on trying to activate it.

The plugin generated 3 characters of unexpected output during
activation. If you notice “headers already sent” messages,
problems with syndication feeds or other issues, try deactivating
or removing this plugin.

There are many possible causes, but in my case the problem was down to having opened the .php in Notepad and accidently saving it as UTF-8 instead of ANSI. I re-saved it as ANSI and it worked again.

Tips for upgrading to WordPress 2.9 on 1and1

Thursday, December 24th, 2009

A few days ago I upgraded the my blog from WordPress 2.8.5 to 2.9. Here are some tips on what I did in case you run into any of the same issues that I did. That blog is hosted by 1and1 and some of the information may be specific to them.

This isn’t meant as a full upgrade guide – just a collection of tips that may help you.

First make sure you backup your data! There are some general wordpress backup tips on a post I did about a previous upgrade.

1. Export the SQL database

In the MySQL admin panel I selected these extra options: ‘Add DROP TABLE’ and ‘Complete inserts’, and then chose to save the file as a .gz (gzip) archive. If you need a free application to read .gz archives then I recommend 7-Zip.

Oneandone MySQL icon

2. Export the XML data

Export the XML post data from the WordPress admin panel (Tools->Export).

3. Zip and downloaded the blog files

Zip up the actual files on the server. On 1and1 the easiest way to do this is to logon to your admin panel, go to the Webspace Explorer, right-click on the directory and select ‘zip’.

You can then right-click on the zip file and choose download to copy it down to your computer.

4. Verify the data

I verified that the exported SQL data, XLM and .zip files were valid. The easiest way to verify the SQL and XLM data is to look at it in a text viewer such as NoteTab Light and make sure that the data at the end of the file is valid. Sometime a download can silently fail and you can end up with truncated data. If you try to restore the data from a truncated file then the restore will fail.

Verify the .gz file by making sure it will open in 7-Zip.

Click on the upgrade button

I finally was ready to click on the upgrade button. I clicked on it and a second or two later I got the message:

‘The update cannot be installed because WordPress 2.9 requires MySQL version 4.1.2 or higher. You are running version 4.0.27’

How I got around it

The partial answer is contained in the post here. However I’ll add a few bits of information on what I did differently.

I created a new MySQL 5.0 database from the MySQL admin panel. On the old 1and1 business hosting package I think you can create two MySQL databases (or up to 10 on the newer business hosting package) so you don’t need to delete the existing one first. Don’t delete it – you may need it if everything goes wrong with the upgrade!

I didn’t import the data by using the XML backup. I imported the data into the new MySQL 5.0 database from the gzipped SQL archive that I’d created in step 1 above.

You can import the SQL data from the MySQL admin panel by going to the tab to execute SQL commands, and then selecting the .gz file. Importing the SQL file through a .gz file gets around the 2MB size limit in the MySQL admin panel.

Importing from the .gz file rather than the .XML will import all your database data, and plugin settings, whereas if you do it from the .XML file you may have to manually re-enter various settings into your blog.

In your wp-config.php you will have to ensure that the DB_NAME, DB_USER, DB_PASSWORD and DB_HOST have been updated with the settings of your new MySQL 5.0 database.

Upload the wp-config.php file and if everything has gone right your blog should still be working and look exactly the same as before. Your blog will be using the old version of WordPress but will be accessing the data from the new MySQL 5.0 database.

You should now be able to click on the upgrade button and the blog should upgrade in less than 5 seconds.

This worked fine for me on 1and1. If you have loads of plugins or a heavily customised theme you may find more problems. If this is the case you can try deactivating plugins, or switch to the default theme.

If you really can’t get things to work you should be able to roll back to your pre-2.9 WordPress blog by restoring the files that you zipped in step 3 above. You MySQL 4.0 database should still be there (as long as you didn’t delete it).

Upgrading WordPress can often be a pain but at least having upgraded the SQL database from 4.0 to 5.0 should avoid more problems in the future. And now with WordPress 2.9 you can look forward to batch updating your plugins rather than doing them one at a time!

Upgrade WordPress to 2.8.1 on 1and1

Tuesday, July 14th, 2009

In the bad old days upgrading anything WordPress related (plugins, themes, or WordPress itself) would at best involve manually downloading a zip, extracting it locally and then using FTP to upload the changes to your web server. At worst it could require manually editing files, and making database changes.

In February last year I wrote about how cool it was that the All in One SEO Plugin had a one-click upgrade facility. Updating plugins had always been a big pain, especially when you have a blog with many plugins (this one has about 10) so it was great when WordPress introduced one-click plugin upgrade support. Although plugins could now be upgraded with a single click, upgrading WordPress itself was still a manual task.

In WordPress 2.7 they introduced one click upgrade support of WordPress itself. When 2.8.0 was released a message at the top of my blog console prompted me to do a one-click upgrade. I decided to wait. Upgrading to a x.x.0 release can be risky. These are major updates and often have many bugs. Waiting until the x.x.1 release can be safer unless there is an urgent reason to upgrade (such as a critical security update).

Another reason for delaying a WordPress upgrade is that it can take a while for the plugins that you use to be updated to be compatible with the new version. Sometime no changes are needed, but when WordPress update their database structure, plugins are particularly vulnerable to breaking.

Even though you can now upgrade from 2.7.x to 2.8.x with one click, upgrading is never that simple. With each upgrade there is a chance that you will completely trash your blog.

Firstly make sure you have plenty of time. If it goes well it shouldn’t take too long. What you don’t want to do is for it to go badly wrong and end up with your blog trashed, just before you have to leave for an urgent appointment.

You MUST do your backups before upgrading. Before backing up I make sure all the plugins are up-to-date and I delete any comment spam so this isn’t backed-up.

I always do three different backups.

  1. File backup – I FTP all the blog files down to my computer.
  2. XML export – Export all the blog information as an XML file using the Tools->Export option.
  3. MySQL database backup – A full MySQL database backup using the backup instructions from the official WordPress website. On 1and1 you select the MySQL admin panel using the highlighted button shown below.

Oneandone MySQL icon

After backing up I verify that the backups look correct. I generally diff the XML and database dump to my previous backup using the Beyond Compare tool. The main thing to check is that the backups haven’t been truncated due to a failed download. If the files are much smaller than previous backups then you may have a problem.

I’d read that in order for the upgrade to work on 1and1 you need to ensure that your website is processing .php files using PHP5 rather than PHP4. To ensure this you must have the below line in your .htaccess file in the root of your blog.

AddType x-mapp-php5 .php

After all this there was just one thing left – to press the ‘Upgrade’ button.

I pressed it and held my breath. Some messages appeared on the screen and about 10-15 seconds later it said the upgrade had succeeded. At first I thought something must have gone wrong, as it was so quick. I logged back into the blog and saw that it had worked!

The only problem that I found was due to me having made some changes to the default theme. These changes had been overwritten. Luckily due to the file backup that I had made by FTP I was able to restore them in a few minutes. The lesson to learn here is not to change the default theme. You should copy it to a new directory and only change the copied version. If you want to keep any updates to the default theme in sync with your modified theme you may have to manually merge them in, but at least you won’t lose your theme updates.

Congratulations to the implementers of this feature in WordPress. It is much appreciated by me :)