Tech Tips

Updating Expression Engine - The Fast Way

Ellis Labs' ExpressionEngine is one of the best CMS packages available; if you've done development work with it, then you're probably already familiar with its advantages over other CMS software, including free/open source options like Drupal or WordPress. And you also probably know that the process of installing updates is definitely NOT one of ExpressionEngine's advantages. The upgrade process involves numerous manual steps, you can't simply overwrite the old files & folders with the new ones (problems will often occur if you don't remove old files first), and the process involves taking your site offline for at least 10-15 minutes - if you follow the upgrade instructions provided by Ellis Labs, that is.

Fortunately, there are a few simple tricks that can speed up the upgrade process considerably, while also making it more straightforward and removing the need to take your site offline for more than a few seconds. Read on for the details.

NOTES AND DISCLAIMERS

First, a bit of a disclaimer: this guide describes the fastest way to perform an ExpressionEngine upgrade, though it's not necessarily the easiest way. I also haven't gone into a huge amount of detail about the specific steps for several reasons: there are numerous ways to accomplish each step, depending on preference and your hosting/server configuration (and your site's configuration). Fully explaining some of the steps would also require a entire guide in their own right, although I have provided examples of the specific steps that I typically use. And most of the steps do require some basic IT skills, as well as familiarity with installing/upgrading web-based applications, and familiarity with managing a hosting account (using SSH or a web-based file manager, etc).

And a final note: this guide assumes that you're using a web server that runs Linux (or another UNIX OS). I've tried not to make the steps too specific to any particular hosting system - we primarily use CPanel-based hosting, but it should work with any other system that allows SSH access or a web-based file manager. Most of the steps will also work on Windows-based servers, though not all - E.g. typically you need a VPS or dedicated server with remote desktop access in order to unzip files directly on a Windows server (there's usually no way to do that with Windows-based virtual/shared hosting).

GETTING STARTED - OFFLINE PREPARATION

Now, let's get started. The first thing you'll want to do is download the latest version from the Ellis Labs/ExpressionEngine website. In a nutshell, the Ellis Labs instructions say to back up the files from your existing site, then delete the online copies, upload the new files, then upload the configuration files/third-party add-ons/themes/etc from your offline backup. Instead, we're just going to prepare everything offline first (on your hard drive) and then upload it all at once.

After you've finished downloading the latest version of ExpressionEngine, unzip it somewhere on your hard drive. If you've renamed your system folder (a good idea), you should update the admin.php and index.php files in your offline copy - you'll also need to rename the new system folder too. Next, open the folder system/expressionengine/config/ (replace "system" with your system folder name, if you've renamed it). You'll need to copy over two files from your existing site, which should be located in the same folder: config.php and database.php - the fastest way is to just use your FTP client to download them to the system/expressionengine/config/ folder.

Next, there are two other folders that you will typically need to copy from the existing site: system/expressionengine/third_party and themes/third_party (download or copy them to the equivalent folders in your new copy of ExpressionEngine). You'll also need to do the same with system/expressionengine/languages (if you've installed any 3rd-party language files) and system/expressionengine/plugins (if you've installed any plugins).

BACKUP YOUR EXISTING INSTALLATION

Now, the most important step: backup your existing site! Let me repeat that with a little more emphasis: BACKING. UP. YOUR. EXISTING. SITE. IS. THE. MOST. IMPORTANT. STEP. FULL. STOP. If you skip this step, it increases the risk of bad things happening - in which case, you have been warned. You need to backup both the files & the database contents. The quickest way to backup the files is to simply zip them on the server, assuming you don't have huge amounts of data and/or diskspace constraints. This can be done through SSH, and most hosting control panels also contain a file manager that will allow you to create zip files (and extract them). It's typically the website root folder that you want to backup, usually called something like public_html, www, wwwroot, httpdocs, or possibly just your domain name (Dreamhost uses the domain name for the web root, for example). Or if you have huge amounts of data that will take too long/too much space to backup, then you can zip just the system and themes folders, as well as the index.php and admin.php files (those are the only ones you'll be replacing during the upgrade). And Just to be safe, it's always a good idea to download backup zip file after you've created it.

There are numerous ways to backup the database as well: most web hosts provide access to your database via PHPMyAdmin, which does include a backup feature. It can also be done through SSH (the "mysqldump" command), desktop MySQL clients, PHP scripts, etc. And many hosting providers offer an account backup feature, which typically gives you a turnkey way to backup both your files AND database contents - the backup feature in CPanel works this way, for example (again, as long as you don't have huge amounts of data stored on the site).

Once you have everything safely backed-up, return to your new offline copy of ExpressionEngine (the files we prepared earlier). Open the folder that contains the ExpressionEngine files & folders (the system & themes folders, etc), select all of them, and add them to a new zip file - in most versions of Windows, you can do that by right-clicking, then selecting "Send To", and then clicking "Compressed (zipped) Folder". Next you'll need to upload the zip file that you just created, it needs to go inside the web root folder.

These next two steps should be performed as close together as possible: rename your existing system & themes folders (E.g. add ".OLD" to the folder names) and then unzip the file you just created, which contains the files for the new version of ExpressionEngine. After you rename the folders, your site will display error messages until you perform the second step (the reason why the second step should be done quickly after the first). Because of this, I find it best to perform both steps through SSH, allowing me to do both with a single command (or more accurately, three commands strung together with double ampersands):

mv system system.OLD && mv themes themes.OLD && unzip ee2.5.5.zip

(replace "ee2.5.5.zip" with the actual name of your zip file)

 

NOTE: The reason I recommend renaming the existing themes & system folders (instead of deleting them) is so that you can easily revert to the original files if something goes wrong. If the upgrade doesn't work for some reason, you just have to remove the new folders, and rename the original themes & system folders back to their original names (sometimes it may be necessary to restore the database backup too).

And, of course, you don't have to use SSH to perform those steps - you can use your hosting control panel's file manager to extract the zip file, for example. There are also a few FTP clients that can unzip files directly on the server as well, though typically they require that you use SFTP instead of plain FTP.

The last step is to open your web browser and go to the admin/dashboard address (E.g. http://yoursite.com/system/). This should take you to the ExpressionEngine upgrade page, and from there it's just a matter of clicking "I Accept" and "Next" a few times - which is how the whole process should work, but I digress (that said, anyone reasonably-comfortable with UNIX/Linux shell scripting could write a script to automate most of the "pre-upgrade" steps, or a PHP script for that matter). If everything went well, you should see the "success" page after a minute or two - then you only need to delete the system/installer/ folder (via FTP or some other method) and you're done. Your site should now be running the latest version of ExpressionEngine.






Comments

Linux and Windows web hosting plans start at just $7.95/mo.