How to test a WordPress install against a new version, without breaking the old one

One problem with upgrading any piece of software is the question of what’s going to break? WordPress is no different in this regard than any other piece of software so before major upgrades I run a test upgrade whilst leaving my real blog alone. There’s no substitute to testing with your real data so what I do is run another WordPress instance under a different virtual domain with a copy of both the database and the installation.

The rough steps I use are:

  • Create a new test domain in DNS
  • Copy the database WordPress uses to a new one and set up appropriate grants on it
  • Go to the options table in the database and change the two references to the old URL of the blog (the siteurl and home rows) to the new URL (otherwise you’ll find yourself constantly getting redirected to the production blog!)
  • Copy your WordPress installation to a new directory (I use rsync -aP to preserve permissions) and configure Apache to serve the new domain from it
  • Edit the copies wp-config.php file to match the new database copy and the username and password for it
  • Go to the new domain and make sure it works!

That should be it really. I first did that for my upgrade to WordPress 2.5 RC1 and it just worked for WordPress 3.2.1.

Caveat emptor: Now warranty, batteries not included, if it breaks you get to keep both parts! 🙂