Moving from Development to Production on EE 2

- Lance Johnson 08.29.2010

There are several guides for server migration under ExpressionEngine 1.x, but so far nothing on migrating ExpressionEngine 2.1. This guide is based our our own experience of moving a site from a development environment to a production environment. We have tried to capture as many aspects of the move as possible, but every EE site is different. You may find that we include steps which you can omit, or you may discover that there are additional steps you need to take.

This tutorial assumes that your development environment is on a different server than your production environment. If this is not the case, you can still use much of this tutorial, but note that some steps may not apply, or may only partially apply.

It can’t be said enough - before you start making any significant changes to your database or file system, backup your data!

STEP 1: Backup your data

Creating a backup of your data is always a good idea before undertaking any major changes. Moving a site from a development environment to a production environment is considered a major change, so make sure you have a backup of your data in case something goes terribly wrong.

STEP 2: Synchronize Templates (if needed)

If you are not saving your templates as flat files (i.e., in the file system), skip to Step 3.

If you are saving your templates as flat files, make certain that your templates are all synchronized before beginning. If your templates are not synchronized, you might encounter some trouble in the production environment, particularly if the last changes you made to the templates were made to the flat files and not in the Template Manager.

To synchronize your templates, in the Control Panel, go to Design > Templates > Synchronize Templates.

Syncronize Templates

If the Sync column has all green check marks, you’re good to go, otherwise, sync those templates that are out of sync until they are all checked green.

Synchronized Templates Checked

STEP 3: Export your Database (MySQL dump)

If you have access to phpMyAdmin in your development environment, login. If not, you will need to export your database using a different tool. Some hosts provide different methods of exporting your data through a hosting control panel, or you might need to use the command line if you are using a local development environment without phpMyAdmin. This step will detail how you go about using phpMyAdmin.

After logging in to phpMyAdmin, select the correct database from the left-hand column. Depending on your environment, you may have only one database listed. Once selected, you should see something like this:


Make a note of the Collation method listed. It will usually be utf8_general_ci, but if there is another collation used, like latin1, make a note of this. When we reimport the data, you will need to use the same collation, or things might break entirely.

Click on the Export tab. You will be presented with a number of options.

SQL Dump Settings

Verify that all of the tables are selected, that you have selected to export as SQL, that you are exporting the Structure of the database, and that you are exporting the data, itself. Verify that the “Save as File” box is ticked, name your export, and click Go. This will generate an SQL file that you must save somewhere. We will need this SQL file to import it into the production environment.

STEP 4: Create a Database on the production server

Now you need to create a new database on your production server. This is generally done through a Database Manager in the hosting control panel. When you create the database, you will either create a MySQL username and password at the same time, or you will assign an existing MySQL username and password to the new database. For security reasons it is a good idea to have a separate username and password for each production database. When creating the database, make a note of the following items, as you will need them later:

  • MySQL hostname or IP address (provided by your host)
  • Database name (generally you select this, but sometimes it is assigned)
  • MySQL username
  • MySQL password

Now, login to phpMyAdmin on the production server. You should see your newly created database in the left-hand column, but it will have no tables assigned to it. Select the database and then select the “import” option on the screen that appears:

SQL Import Option

You will now be presented with the import options:

MySQL Import Settings

Select the SQL file that was created in Step 3. Verify that the same collation is being used. For most database imports, you should uncheck to box under Partial Import. If your SQL file is very large, it might exceed limits set on your server. In the example image above, the limit is 7,168 KiB. Your server may vary. If your SQL file is smaller than the size limit, you should always uncheck the Partial Import box. If your file is larger than the limit, you can allow partial imports. Partial imports are beyond the scope of this tutorial and will not be covered further.

Once set, click the “Go” button to upload and import your data. If successful, the left-hand column should populate with all of your tables.

STEP 5: Migrate The File System and Set Permissions

First, if you are deploying an ExpressionEngine site to a production environment where a non-ExpressionEngine website currently exists, backup the data on the existing production server. Do not simply delete the existing file system or overwrite it. If something goes wrong, you will not be able to recover the old production system.

Now, make sure that the development file system is backed up. (You already did that in step 1, right?)

You have two options for migrating the development file system. The fastest is generally to archive the contents of the development server (zip or tar, for example) and upload the archive to the production server where you will extract the contents. However, if your hosting control panel does not give you access to create an archive (on the development server) or extract an archive (on the production server) this option may not be available.

If you can’t create an archive on the development server, but you can extract one on the production server, you can download the file system to your local machine and create the archive locally.

If you can’t extract the archive on the production server, you will need to upload the file system as folders and files, which will take longer.

Once you have all of the files in place on the production server, whether you used the archive method or the individual files method, you must verify permissions as follows. If you are using a Unix server (or Unix variant, like Linux, OS X, FreeBSD, etc.) you must set the following files to 666 (or equivalent write permissions on your server):


And the follow directories to 777 (or equivalent write permissions on your server):


If you are saving templates as flat files, you must set the relevant directory (and all its subdirectories) (usually located inside /system/expressionengine/templates/) to 755.

If you have any other special directories or files that require permissions, set those now. For example, several add-ons that manipulate files, such as ED Image Resizer, require that the directory for sized images be set to 777.

STEP 6: Update database.php & config.php

Now, grab those notes about the database, and use them to update the contents of /system/expressionengine/config/database.php.

Next, open /system/expressionengine/config/config.php and set the correct URLS for the following variables:


STEP 7: Update paths in the Control Panel

If all has gone well so far, you should be able to login to your control panel at http://yourdomain.tld/system/. If the server balks, try http://yourdomain.tld/system/index.php. If you still can’t get the Control Panel, something has gone wrong. I hope you backed everything up.

Once you have logged into the CP, there are several places where you need to change paths. If you don’t know your new server path, there are several ways to find this. The easiest is to look for the _SERVER[“DOMAIN_PATH”] variable in Tools > Utilities > PHP Info:

PHP Info

Once you have your path information, update it in the CP. Here are the most common area you’ll need to update:

  • Admin > Channel Administration > Channels > Edit Preferences > Path Settings (URLs for each channel, and any other URLs set. Even if these are just set to the default, they will use the old server paths, and should be updated for clarity and developer hygiene.)
  • Admin > General Configuration (three URLs and one path)
  • Admin > Content Administration > File Upload Preferences (both path and URL for each upload destination set)
  • Admin > System Administration > Image Resizing Preferences (this is only required if using ImageMagick or NetPBM - if it wasn’t set before and everything was working as you expected, it doesn’t need to be set now)
  • Admin > System Administration > Emoticon Preferences
  • Admin > Security and Privacy > CAPTCHA Preferences
  • Design > Template Manager > Global Template Preferences (only required if you are saving templates as flat files)

STEP 8: Update paths in templates, CSS, JS, and third-party add-ons

If you used any server paths or absolute URLs pointing to your development environment anywhere else, you need to update those now. Common things to look out for:

  • tags in templates
  • Hard-coded absolute URLs in templates (should be rare - if you’re using these, try instead)
  • paths set in CSS or JS - especially JavaScripts that aren’t being parsed by EE. EE tries not to parse JS files, so if your JS needs a path, you probably had to hard code it
  • paths set in third-party add-ons, either in the CP, or sometimes in one of the files living in the file system (like ED Image Resizer, which required the plugin file to contain two paths)
  • images or files included in entries if you hard-coded the links, or if your WYSIWIG editor hard-coded the links (if you have a lot of these, you might try using the SQL Manager in Tools > Data > SQL Manager or the Search and Replace in Tools > Data > Search and Replace)

SQL Manager
Search and Replace

STEP 9: Verify Template Synchronization

If you aren’t saving templates as files, skip to Step 10.

If you are saving templates as files, verify that you can properly sync your templates using the Synchronize Templates feature. If you can’t, you may need to delete the directory specified in Design > Template Manager > Global Template Preferences from the file system and recreate that directory again on the production server. This is only true on servers that have ownership issues with the your specified template directory.

STEP 10: Clear your cache

Clear all Caches in Tools > Data > Clear Caching

  Clear Caching Menu
Clear Caching Option

This is to verify that there is no residual cache data from the development server.

STEP 11: Load the site

If all went well, you should be able to navigate to http://yourdomain.tld/ and everything will work.

Good Luck!

schedule a call