Website Migration Guides

A simple free resource for website migration

How to migrate ZenCart to a new host / server

Zencart is an ecommerce system that is close to my heart. It was one of the first ecommerce systems I ever used and whist it may not be as popular as other ecommerce systems on the market, it's still in use by thousands of users and has an active forum.

Moving a ZenCart website from one server/host to another does look complicated but the good news is it actually quite easy to do (especially if you have the right migration guide to follow).

The below step by step guide will talk you through how to move your ZenCart 1.5 website to a new hosting company.

Please note, this guide follows the official guidelines on migration as recommended by ZenCart. As such, it is different to other guides online (which incorrectly skip the fresh install steps in favour of updating the configure.php files manually).

1. Check your ZenCart version and upgrade if required

Before you do anything, check what version of ZenCart you are currently running. This can be found in the top right hand corner of your ZenCart admin area.

ZenCart Version

Make a note of this (e.g. in the above image it's version '1.5.6a') as you will need it later.

It is important to note that when moving hosting companies you should never try and upgrade your ZenCart site. An upgrade should be done either before or after the migration is complete but never during the migration.

2. Backup your ZenCart website

The key to any sucsessful migration being headache free is to make sure you have a full website backup. If anything should go wrong, the backup will allow you to restore your website.

Whilst many hosting companies offer a 1 click backup feature (which is great), the below guide will show you how to take an 'old school' backup of your ZenCart website using FTP and PhpMyAdmin (don't worry if you haven't heard of these terms before). The reason we have done this is that all hosts provide FTP and PhpMyAdmin access and as such anyone should be able to follow this guide.

The first step is to download a FTP program. A FTP program is an application/software that allows you to connect to your website hosting and view the ZenCart files/folders. You can use any FTP client you like but in this guide we will be using FileZilla FTP. The reason for this is it's a popular FTP program and it's free to download.

You can download FileZilla for free from https://filezilla-project.org

Once you have downloaded and installed FileZilla, you will need to collect your FTP login details from your current host. Usually these can be found in a welcome e-mail or in your hosting control panel. You will need:

1. FTP host
2. FTP username
3. FTP password
4. FTP port (usually 21).

If you are unable to locate the above login details, copy the below and send it to your host.

Hello, can you please confirm my FTP login details for my hosting including my FTP host, username, password and port number?

Now that you have your FTP login details, you will need to create a new folder on your computer (so you have somewhere to download the backup to). Create a new folder on your computer and call it "ZenCart Backup".

2.1 Backup Your Zencart Files

Open up FileZilla and enter your FTP connection details across the top, then click the "Quickconnect" button.

ZenCart FTP Backup

You should see some connection text appear in the top box then after a few seconds you should see a list of folders appear in the right pane. In this list of folders, you will find your website public folder. This is where your ZenCart website / folders are and it is usually called "public_html" or "htdocs". Double click your public folder to open it.

ZenCart's public_html folder

You should now see a list of your ZenCart files / folders. These folders include (but are not limited to) "cache", "includes", "media" and "pub". You will also have one folder with a random name that will not match our example below (this is your admin folder). In the example below this is the adUlt-jjS-briSk folder.

ZenCart file structure

TIP : If you do not see these files then you are in the wrong location/folder or your ZenCart website is run from a sub folder. This can happen if your website address is e.g. www.yourstore.co.uk/shop/, where "/shop/" is the name of the folder you would need to find the folder and open it to see your ZenCart files.

In the left pane of FileZilla, open the "Zencart Backup" folder you made earlier (if you did not make one, you can make one now by right clicking on the left pane and clicking "Create Directory") and then open it by double clicking on it.

ZenCart Backup

You should now have a blank pane on the left hand side and your ZenCart website's files/folders in the right hand pane.

ZenCart backup step 1

Select all the Zencart files/folders in the right hand pane to turn them blue in colour (on a windows computer, click any folder in the right pane once, then press 'CTRL' and 'A' to select all the files/folders) then right click and select 'Download'.

ZenCart Download step 2

You should now see lots of activity at the bottom of FileZilla as it downloads your files/folders.

Zencart Files Downloading

TIP : Once complete, check the "failed transfers" tab to make sure no files have failed to download. If they have, right click on them and restart them (using "Reset and requeue selected files").

That's it, you have now backed up your ZenCart's files and folders into your "ZenCart backup" folder.

2.2 Backup Your Zencart Database

Now that you have a backup of your ZenCart's files, you need to backup the database.

The first step is to check what your database is called, to do this, open the "ZenCart backup" folder you made earlier and look for the 'includes' folder. Open this folder up and you should see a file called "configure.php"

Zencart's configure.php

Open this file up in a plain text editor such as notepad and look for the line

define('DB_DATABASE', 'XXXXXXX');

(Yours will have something other than 'XXXXXXX')

What you have written instead of XXXXXXX is the name of your database.

Now that you know the name of your database, you can move on to backing it up. Backing up a database is very easy to do and can be done using PhpMyAdmin. PhpMyAdmin is a free software tool provided by virtually all hosting companies and can usually be accessed via your hosts control panel (look for a link called My SQL Databases or PhpMyAdmin).

If you are unable to locate PhpMyAdmin, copy and paste the below into a message to your host.

Hello, can you please confirm how I can access my ZenCart database via PhpMyAdmin?

Once you have found the link to PhpMyAdmin, open it up and select your database from the menu on the left (this will be the same name as the XXXXXXX above).

Select zencart database

On the right hand side, you should now see your ZenCart tables. These will include (but are not limited to) "address_book", "configuration", "db_cache" and "zones".

ZenCart Tables

Across the top, you should see an 'Export' tab, click this to load up the export page.

export zencart database

Next, click the Custom radio button.

custom export

From the 'Compression' dropdown select "zipped".

zipped export

Finally, scroll down to the bottom of the page and click the 'Go' button. This will then download a copy of your database to your computer.

go export

3. Put ZenCart into maintenance mode

Now that you have a backup of your website, you need to stop any new orders from being placed. This is because when you move on to restoring your backup later (on your new host), any new orders would not be copied across.

To stop any orders being placed, you can put ZenCart into maintenance mode. To do this, log into your ZenCart admin area and move over 'Configuration' and click 'Website Maintenance' from the dropdown.

zencart maintenance mode

Make sure the "Down for Maintenance: ON/OFF" is selected and click the "Edit" button on the right.

Down for Maintenance

Click the "true" radio button then click "Update".

Website offline

Your website will now show a "The site is currently down for maintenance. Please excuse the dust, and try back later." message and stop any customers from placing a new order.

4. Collect your database prefix

Open up your ZenCart Backup folder then open up the includes folder and finally open up the configure.php file (again using notepad or a plain text editor).

Locate the line:

define('DB_PREFIX', 'AAAAAA');

(Yours will have something other than 'AAAAAA')

Whatever is written (if anything) where AAAAAA is, is your database prefix. Make a note of this (remembering it is case sensetive) as you will need it later.

5. Complete a fresh Install of Zencart on the new server

At this point you may be asking why would I perform a fresh install of Zencart instead of just restoring my backup? Whilst you could do this, a clean install will make sure that all your configuration files are set up 100% correctly (avoiding a lot of the hassle that comes with incorrect paths and database details).

IMPORTANT : We strongly suggest against using any automatic ZenCart install programs often provided by hosts at this stage. Often these systems add extra files or modified versions of ZenCart which can cause issues later on.

5.1 Download a fresh copy of ZenCart

In step one above, you made a note of your ZenCart version. In order to make sure no issues occur during the next stages, you will need to download the exact same version of ZenCart from https://sourceforge.net/projects/zencart/files/. Do not use any other version as it will result in errors occuring at a later date.

5.2 Extract ZenCart

The next step is to unzip the ZIP you downloaded in 5.1 above. On a Windows computer, right click on the zip and select "Extract All..."

Extract zencart

In the popup window, make note of the destination then click extract (in this example we will extract it to the desktop to keep things simple).

Select ZenCart destination folder

You should now have a new folder usually called zen-cart-vXXXXXXX (where XXXXX is the version). Open up this folder and check it extracted correctly (you should see a list of Zencart files / folders including (but not limited to) "admin", "cache", "downloads" and " zc_install").

New Zencart Files

5.3 Upload ZenCart to your new host

The next stage is to upload the files/folders you unzipped in step 5.2 to your new host's public folder. In order to do this, you will need to use a FTP client and in turn will need your new host's FTP login details. As with your old host, you will need the FTP Host, username, password and port number. If you do not know these, ask your host the below question.

Hello, can you please confirm my FTP login details for my hosting including my FTP host, username, password and port number? Can you also confirm the name of my public folder (e.g. public_html or htdocs)?

Open up FileZilla again and enter your new host's FTP login details at the top then click "Quickconnect".

New ZenCart host's FTP

Once connected, locate your host's public folder (usually called public_html or htdocs or www) in the right hand pane and open it.

New hosts public_html folder

In the left pane, locate the folder where you unzipped the new ZenCart that you downloaded in step 5.2 e.g zen-cart-vXXXXXXX (where XXXXX is the version) and open it.

zen-cart-v1.5.6a-01042019

You should now have in the left pane your freshly downloaded version of ZenCart and in the right pane your new hosts public folder.

Zencart upload step 1

Select all the files/folders in the left pane (so they are highlighted in blue) then right click on any file and choose "Upload".

Upload Zencart 1.5

You should now see the new ZenCart files being uploaded to your new hosting.

Uploading zencart files via FTP

Once complete, close FileZilla for now.

5.4 Update Nameservers (optional)

At this point, you need to be able to access your new hosting via your website domain e.g. www.yourshop.com. However, it will currently be pointing to your old hosting and in turn loading your old "down for maintenance" ZenCart site.

This means you have three options:

  1. Change Nameservers (easiest but results in website downtime).
    Update the nameservers on your domain to point to your new host. This can take up to 24 hours to propagate online but is the easiest option. Your new host will be able to provide you with your new nameservers and your old host/domain registrar will be able to help you change to them.
  2. Update the DNS (quicker but slightly harder to do).
    Update the domain's www and blank (aka @) DNS to point to your new host's IP. Again your new host will be able to provide you with the IP address and your old host/registrar will be able to update the domain's www and blank A records to point to this IP.
  3. Edit your computer's hosts file (recommended)
    This is the option we would recommend as it doesn't result in any downtime for your website and only you will see the new hosting (allowing you to fully re-set up the site before any customers can see it). We won't go into details on how to do this on here as there are plenty of good guides online e.g. https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ that already cover this.

Once you have completed one of the above, you can move onto 5.4 below.

5.4 Setup a new database

Before you can start the new ZenCart install, you will need to set up a new database with your new host and find out how to access it via PhpMyAdmin. These steps can vary drastically depending on the host (some of which we have covered in the "ADDITIONAL NON CMS RELATED GUIDES" on our homepage). Contact your new host and ask them the below

Hello, Can you please confirm how I can:
1) Set up a new MySQL database?
2) Where I can find the MySQL database name, username, password and host?
3) How I can access the database via PhpMyAdmin?

If you create the database yourself, make sure to write down the MySQL database name, the MySQL username, the MySQL password and the MySQL host (usually localhost) as you will need these later.

5.5 Run the ZenCart install

Open up your website in a browser (e.g. Google Chrome, Microsoft Edge) and you should see the ZenCart 1.5 install screen.

Click the "CLICK HERE" link in option one under "This is your first time using Zen Cart".

This is your first time using Zen Cart

Assuming you do not have any error messages, click continue. If you do, contact your host and let them know what they are (they should then be able to help you fix them).

System Inspection

Tick the "Agree to license terms:" box and check the website addresses are correct in all of the boxes (this will usually be autofilled correctly for you). Then click "Continue".

System Setup

The next stage is the database setup. It is important to get this step 100% correct or when you restore your shop's database later on, it will not work. Using the database details from the new database that you set up in step 5.4, complete the following;

  1. Enter your database host (usually "localhost") into the Database Host box.
  2. Enter your database username into the "Database User" box.
  3. Enter your database password into the "Database Password" box.
  4. Enter your database name into the "Database Name" box.
  5. Tick "Load Demo Data".
  6. Next to "Store Prefix" you will need to enter your old database's prefix exactly as it was listed in step 4 earlier in this guide.

Database Setup

A progress bar will appear if the database settings are correct (if not, recheck over your settings with the ones provided by your new host).

Creating ZenCart Database

Fill in the requested details and make note of the "Admin Directory" as you will need this later. Then click "Continue".

Admin Setup

IMPORTANT : Make sure to write down the "Admin Directory" exactly as it is displayed (CaSe-SenSeTiVe). If this is noted incorrectly, your admin will not work later when it is restored.

If your new hosting is running Nginx, click the link and follow the steps to secure your ZenCart site (if you do not know if you are using Nginx, contact your new host for clarification).

Zencart Setup Finished

You will now need to delete the 'zc_install' folder from your new host via FTP. To do this, open up FileZilla and connect to your new host (as you did earlier). Open up your public folder again (e.g. public_html) and locate the 'zc_install' folder. Right click on the folder and select 'Delete'.

Delete zc_install

Once the folder has been deleted, move onto step 6 below.

6. Update your backup

Now that you have a fully working new install of ZenCart on your new host, you will need to update/remove some files/folders in your backup (from step 1).

6.1 Remove the two configure.php files

First you need to remove two files from your backup called configure.php. Whilst they share the same name, they are NOT the same file.

Open your "zencart backup" folder and open the includes folder. Inside this folder, you will see the first configure.php file. Remove this file from the folder (e.g. either delete it or move it somewhere outside your "zencart backup" folder (recommended).

The next configure.php file is inside your admin/includes folder (your admin folder will be a random series of words/letters). Open up your admin folder and then open the includes folder. As before, move the configure.php file outside of your "Zencart backup" folder.

IMPORTANT : It is vital that both /includes/configure.php and /NAME_OF_YOUR_RENAMED_ADMIN_FOLDER/includes/configure.php are NOT located inside your ZenCart backup. Uploading these to the new host in the upcoming steps will result in you having to restart step 5.

6.2 Rename your admin folder

Next, you need to rename your admin folder. Near the end of step 5.5 you made a note of your new admin folder name, rename the admin in your backup to match this exactly (it's case sensitive).

Rename Zencart Admin

7. Upload your old website files/folders

You're now ready to start restoring your website. To do this, you will be uploading your backup over the top of the 'new' zencart site.

Open up FileZilla again and connect to your new host then open the public folder (as before). You should see your new ZenCart website files/folders.

In the left pane open up the ZenCart backup you took in step 1 (and that you edited in step 6).

Uploading Zencart Backup

FINAL WARNING! : If you have not completed step 6, do not proceed. Doing so will mean starting the guide again!!

Select all of the ZenCart backup files/folders in the left pane then right click on any of them and select upload.

Upload Zencart Backup

Your files will start uploading and shortly after you will get a "Target file already exists" message. This is simply saying that a file on your server with the same name already exists (which is correct as your new version of ZenCart is currently online).

Tick the "Overwrite" radio button then tick the "Always use this action" and "Apply to current queue only" boxes. Then click the "OK" button.

zencart overwrite

You will now see your ZenCart file backup being uploaded at the bottom.

Uploading ZenCart Backup

Once complete, check the failed transfers for any files that have not uploaded correctly and re-upload these if any are found.

8. Restore ZenCart's Database

Now that you have uploaded the backup of your ZenCart files and folders, the last restore step is to drop the data from the new database (that you set up in step 5.5) and import the data from your database backup.

On your new host, open up PhpMyAdmin and select your ZenCart database from the left menu (if you are not sure what the database is called, it is what you entered in the "Database Name" box in step 5.5).

Select new zencart database

You should now see a list of ZenCart tables. Scroll down to the bottom and click the "Check all / Check tables having overhead" box. Then from the dropdown click "drop".

Drop ZenCart tables

You should now see a warning message regarding dropping the ZenCart tables.

WARNING : Make sure you are in your NEW ZenCart database on your NEW host (not your OLD host) as this will delete all the data in the database.

Click the "Yes" button to continue.

Do you really want to execute the following query

You should now see the message "No tables found in database.".

Click the Import tab at the top of the page.

Import database tab

Click the "Choose file" button and select the database backup (SQL) that you took in step 2.2, then click "Open".

zencart sql backup

Click the "Go" button at the bottom to start the import.

Go.

You should see an "Import has been successfully finished" message appear at the top once the import is completed.

Import has been successfully finished, 311 queries executed.

If you are running ZenCart version 1.5.2 or newer, that's it. Your website should now load and you've moved to the new server! If you are running an earlier version of ZenCart then you will need to follow the additional steps below.

9. Run the Fix_Cache_Key Plugin

If you are running ZenCart version 1.5.1 or older, you will need to reset your "SESSION_WRITE_DIRECTORY" key in the database (if not, you can skip to step 10). The good news is ZenCart have a plugin to do this for you. Head over to https://www.zen-cart.com/downloads.php?do=file&id=8 and download the "Fix Cache Key.zip" file.

Fix Cache Key

Extract the "Fix Cache Key.zip" file on your computer.

extract zip file

You should now see a folder with "fix_cache_key.php" inside it. Open up FileZilla and connect to your new host again. Once connected, open up the public_html folder in the right pane and open the folder where fix_cache_key.php is located in the left pane. Right click on fix_cache_key.php and select upload.

Fix Cache Key upload

Keep FileZilla open as you will need it again shortly.

Once "fix_cache_key.php" has uploaded, open up your browser and enter the address of the file to open it. e.g. if your website is at www.yourwebsite.co.uk, the file would be at www.yourwebsite.co.uk/fix_cache_key.php

At this stage one of two things will happen.

1. If the keys match, you will see the message "No changes required".
2. If the keys do not match, you will see "Now synchronizing..." and it will synchronise the keys.

Cache Settings Synchronization Tool

Go back to FileZilla and in the right pane, right click on "fix_cache_key.php" and click "Delete"

Delete file

10. Delete the old ZenCart website + check e-mail settings.

So by this stage, you should have a fully functional copy of your website on your new host. At this stage we would suggest :

  1. Logging into your admin and checking the e-mail settings (Admin->Configuration->Email Options). These may contain settings such as SMTP host, password etc that are from your old hosting company.
  2. Delete your files/database from your old hosting. Leaving your data on your old host could be very costly and could even breach GDPR laws (if you sell in the EU) if the data is compromised. As such, you should always delete the database and the files/folders. Personally, we would suggest doing this manually (using FTP and PhpMyAdmin) and then asking your old host to delete the hosting package. This way, you can be sure the data has been deleted and will not be left on a hosting package somewhere in the datacentre.

 

Comments

If this guide has helped you or if you feel it could be improved, please let us know in the comments below.

Hi, did this site help you?

I'm John and this little website is my online side project. It isn't sponsored by any company and I rely solely on donations to pay the hosting fees. If this site has helped you please consider making a small donation using the link below.

Thanks again and happy surfing.