Zen Cart

How to Move Zen Cart to a New Server

Friday, May 7th, 2010

Moving Zen Cart is a regular part of my job description.  I do it often enough that I thought it might be useful to share how to do it for others:

  1. Using FTP, copy your entire Zen Cart Directory from the current server to your local computer
  2. Using FTP, copy your entire Zen Cart Directory to the new server
  3. Export the Zen Cart database from your current server
  4. Import the Zen Cart database to the new server

Now things get interesting.  There’s a few adjustments that need to be made both to the database and to the configure.php files:

Note: There are TWO configure files – one is in includes/configure.php, and the other is in admin/includes/configure.php

First, we will address the admin includes file.

In this example, the installation is in a directory titled shop.  If you were to visit the site, the url would be http://www.mydomain.com/shop.

Open it in your favorite editor, and look for these lines:

define('HTTP_SERVER', 'http://www.mydomain.com/shop');
define('HTTPS_SERVER', 'https://www.mydomain.com/shop');
define('HTTP_CATALOG_SERVER', 'http://www.mydomain.com');
define('HTTPS_CATALOG_SERVER', 'https://www.mydomain.com');

In these lines, it’s fairly clear what needs to be done: replace mydomain.com with the new domain name.

Now look for this line:

define('DIR_FS_CATALOG', '/home/yourname/public_html/shop/');

This one can be a bit trickier.  Basically, you have to find out what your new path is to your installation.  Then, you need to replace the path above with your new path.

Then, look for this line:

define('DIR_FS_SQL_CACHE', '/home/yourname/public_html/shop/cache');

Last thing in the admin configure.php file is this:
Finally, we need to deal with the database settings. Look for these lines:

define('DB_SERVER', 'localhost');
  define('DB_SERVER_USERNAME', 'caleberg_racetec');
  define('DB_SERVER_PASSWORD', '123racetech456 ');
  define('DB_DATABASE', 'caleberg_racetech_zen');

Change them to your new host database settings.

Then, FTP this file up to your new server, replacing the admin/includes/configure.php file.

Then Edit the includes/configure.php File

Look for these lines:

define('HTTP_SERVER', 'http://www.mydomain.com');
define('HTTPS_SERVER', 'https://www.mydomain.com');
define('HTTP_CATALOG_SERVER', 'http://www.mydomain.com');
define('HTTPS_CATALOG_SERVER', 'https://www.mydomain.com');

Just like with the other configure file, replace mydomain.com with the new domain name.

Now look for this line:

define('DIR_FS_CATALOG', '/home/yourname/public_html/shop/');

Again, the change is like the other configure file.

Then, look for this line:

define('DIR_FS_SQL_CACHE', '/home/yourname/public_html/shop/cache');

Finally, we need to deal with the database settings. Look for these lines:

define('DB_SERVER', 'localhost');
  define('DB_SERVER_USERNAME', 'caleberg_racetec');
  define('DB_SERVER_PASSWORD', '123racetech456 ');
  define('DB_DATABASE', 'caleberg_racetech_zen');

Change them to match your new server’s database information.

Upload this file to your new server, replacing the includes/configure.php file.

Last thing to do is to update your session key. The Zen Cart team has created a utility that makes it simple – go here and download it, and follow their instructions: Fix Cache Key tool and instructions.