Cart Advisor is for sale!

Read more here

How To Move An OpenCart Installation To A New Domain

By Jack
In OpenCart
Feb 20th, 2012
93 Comments
86939 Views

The title says it all! In this tutorial we will be looking at how to move your OpenCart shopping website to a new domain whilst keeping all of your products, pages and data. It’s a few step process but one that lots of people ask me about so I thought I would put up a decent blog to walk you through it.

Surprisingly enough, it is actually quite easy to move your OpenCart store to a new server. A bit fiddly perhaps but it doesn’t require much in the way of hardcore development skills and anybody can jump through the hoops to get it done! So, lets start with backing up your data.

Step 1: Exporting Your OpenCart MySQL Database

This requires you to log in to your existing web hosting account and head to the PHP MyAdmin (or eqivalent) where your database is located. Then choose the “Export” option on the navigation bar at the top:

export_phpmyadmin

You will now be taken to an export option screen to choose the file format of the export file, what file this needs to be depends on the type of web host you are moving to but if they have PHP MyAdmin installed then you are safe with any. For peace of mind, I would recommend using the SQL format or CSV for Excel (Comma Separated Values) just for consistency as these are generally supported by any decent web server. Leave all other values as the default:

export_phpmyadmin2

Depending on how many products you have in the database you may find that the backup takes a while to download, don’t be worried. Remember that this database holds all of your OpenCart Products, Categories, Information Pages, Shop Options, Meta Data and other statements which are required for the E-Commerce system to run!

Step 2: Back Up Your Entire OpenCart Store

While that is downloading you should be creating a complete backup of all your OpenCart files and saving them to a folder on your computer. You can do this through your web host control panel or with an FTP program such as FileZilla. Make sure that you have every file on your OpenCart server backed up and then you can pat yourself on the back: you’re halfway to moving your OpenCart store to a new domain!

Step 3: Import Your OpenCart Database Into Your New Domain

Now that you have your files backed up it is time to move your database to the new host. Log in to your new web host and head to their PHP MyAdmin area and click on the “import” tab along the top of the page:

import_phpmyadmin

You will then be taken to a page where you can choose your OpenCart back up database file and make sure to choose the correct format you chose in Step 1. The PHP MyAdmin system will do all of the hard work by taking the data and making a new database with all of your old information! Easy, right?

Step 4: Reconfiguring Your OpenCart Website To Work On The New Domain

This is undoubtedly the trickiest bit of moving your OpenCart website to a new domain or server. Most people overlook it completely and then can’t find the original files and lose hope and delete everything. But stick with me, once again, it is just about jumping through the hoops!

You will need to open up two files from your back up of the OpenCart web pages. These files are:

  • [YOUR BACKUP FOLDER]/config.php
  • [YOUR BACKUP FOLDER]/admin/config.php

For each file you will be faced with two dozen or so lines of text which are defining root folders and MySQL Connection values etc. The only thing you need to do is replace them with your new domain paths! So replace the file lines with the following (remember to put your actual domain name where I have put “[YOUR NEW DOMAIN]“!) as I have shown step by step below:

The Standard HTTP root files

// HTTP
define('HTTP_SERVER', 'http://www.[YOUR NEW DOMAIN].com/');
define('HTTP_IMAGE', 'http://www.[YOUR NEW DOMAIN].com/image/');
define('HTTP_ADMIN', 'http://www.[YOUR NEW DOMAIN].com/admin/');

The Secure Connection root file path

// HTTPS
define('HTTPS_SERVER', 'http://www.[YOUR NEW DOMAIN].com/');
define('HTTPS_IMAGE', 'http://www.[YOUR NEW DOMAIN].com/image/');

The Global Directory Paths

// DIR
define('DIR_APPLICATION', '/catalog/');
define('DIR_SYSTEM', '/system/');
define('DIR_DATABASE', '/system/database/');
define('DIR_LANGUAGE', '/catalog/language/');
define('DIR_TEMPLATE', '/catalog/view/theme/');
define('DIR_CONFIG', '/system/config/');
define('DIR_IMAGE', '/image/');
define('DIR_CACHE', '/system/cache/');
define('DIR_DOWNLOAD', '/download/');
define('DIR_LOGS', '/system/logs/');

Your OpenCart MySQL Database Connection Details

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', '[MYSQL HOST]');
define('DB_USERNAME', '[MYSQL USERNAME]');
define('DB_PASSWORD', '[MYSQL PASSWORD]');
define('DB_DATABASE', '[MYSQL DATABASE NAME]');
define('DB_PREFIX', '[MYSQL DATABASE PREFIX]');//The standard is "opn_" without quotes

Here is the full text if you want to just copy and paste it all in one go:

// HTTP
define('HTTP_SERVER', 'http://www.[YOUR NEW DOMAIN].com/');
define('HTTP_IMAGE', 'http://www.[YOUR NEW DOMAIN].com/image/');
define('HTTP_ADMIN', 'http://www.[YOUR NEW DOMAIN].com/admin/');

// HTTPS
define('HTTPS_SERVER', 'http://www.[YOUR NEW DOMAIN].com/');
define('HTTPS_IMAGE', 'http://www.[YOUR NEW DOMAIN].com/image/');

// DIR
define('DIR_APPLICATION', '/catalog/');
define('DIR_SYSTEM', '/system/');
define('DIR_DATABASE', '/system/database/');
define('DIR_LANGUAGE', '/catalog/language/');
define('DIR_TEMPLATE', '/catalog/view/theme/');
define('DIR_CONFIG', '/system/config/');
define('DIR_IMAGE', '/image/');
define('DIR_CACHE', '/system/cache/');
define('DIR_DOWNLOAD', '/download/');
define('DIR_LOGS', '/system/logs/');

define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', '[MYSQL HOST]');
define('DB_USERNAME', '[MYSQL USERNAME]');
define('DB_PASSWORD', '[MYSQL PASSWORD]');
define('DB_DATABASE', '[MYSQL DATABASE NAME]');
define('DB_PREFIX', '[MYSQL DATABASE PREFIX]');//The standard is "opn_" without quotes

The Admin Config file works exactly the same but you have to add the “/admin” element to each file location. Such as below:

// HTTP
define('HTTP_SERVER', 'http://www.[YOUR NEW DOMAIN].com/admin/');
define('HTTP_CATALOG', 'http://www.[YOUR NEW DOMAIN].com/');
define('HTTP_IMAGE', 'http://www.[YOUR NEW DOMAIN].com/image/');

// HTTPS
define('HTTPS_SERVER', 'http://www.[YOUR NEW DOMAIN].com/admin/');
define('HTTPS_IMAGE', 'http://www.[YOUR NEW DOMAIN].com/image/');

// DIR
define('DIR_APPLICATION', '/admin/');
define('DIR_SYSTEM', '/system/');
define('DIR_DATABASE', '/system/database/');
define('DIR_LANGUAGE', '/admin/language/');
define('DIR_TEMPLATE', '/admin/view/template/');
define('DIR_CONFIG', '/system/config/');
define('DIR_IMAGE', '/image/');
define('DIR_CACHE', '/system/cache/');
define('DIR_DOWNLOAD', '/download/');
define('DIR_LOGS', '/system/logs/');
define('DIR_CATALOG', '/catalog/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', '[MYSQL HOST]');
define('DB_USERNAME', '[MYSQL USERNAME]');
define('DB_PASSWORD', '[MYSQL PASSWORD]');
define('DB_DATABASE', '[MYSQL DATABASE]');
define('DB_PREFIX', '[MYSQL PREFIX]');//Same as before with the "opn_" as standard

Notice that not all the file paths have the admin folder included, this is not a typo, it is the right way to put the file paths, so don’t include them if they are not shown here or you will get a MySQL error!

Step 4: Upload Your OpenCart Back Up Files To Your New Domain

Now that nightmare is out of the way all you have to do is upload all of your files to the new domain server and everything will work as on the past site. Remember that if you have put in custom links in the information pages (or edited the controller/template files) you will need to go through them and change the domain it is pointing to!

Apart from that, your new website is good to go! The good thing about this method is that it leaves the old one intact when the OpenCart site has been moved to the new domain! So, if you start getting all sentimental about your old domain it can still be there for old customers.

A Marketing Freebie

Here is an extra little tip for you out there are who are moving permanently to a new domain. Putting a 301 redirect can kicik Google into indexing faster and keeps most of the link juice from other sites that once pointed to your old domain and transfers it to your new domain. It can be an easy way to inform Google that you have moved domain and to keep you listed at a similar level on the SERPs (Search Engine Results Pages). In addition it does the standard task of redirecting customers who go to your old domain to your new OpenCart location!

Open up this file from your old OpenCart site and make the changes shown below:

  • /catalog/view/theme/[YOUR THEME]/template/common/header.tpl
<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://[YOUR NEW DOMAIN]/");
exit();
?>

This will send all of your customers to the new domain location and pass on all the links pointing to your old website to the new one as well! If you don’t think this is relevant, think of all the people who might have bookmarked, written down or click on their history to get to your site rather than typing out the full address in the URL bar in their browser. For two minutes work, it is always worth redirecting to your new website!

Struggling to move your OpenCart store?

Tutorials like these can sometimes feel daunting, if you want your OpenCart store moving then we can help. Destrove can help you move your OpenCart website onto a new domain, web hosting account or folder for a low Micro Service fee, we have worked on dozens of OpenCart projects and can move your OpenCart store across smoothly and safely.

Click here to read more about Destrove’s Opencart Transfer Micro Service, if you want to ask anything then feel free to contact us on info@destrove.com

I hope this tutorial was helpful and as always if you want anything clarifying or want to ask me anything feel free to leave a comment below!

Posted By

Has 60 Posts

The founder of Cart Advisor, is an eCommerce developer specialising in OpenCart development and content SEO. Based in Lincoln, UK, Jack has worked with hundreds of businesses and runs his own company Destrove which offers OpenCart Development, OpenCart Theme Design and more.

93 Responses to “How To Move An OpenCart Installation To A New Domain”

  1. Amos Adamiak says:

    I am impressed with this site, really I am a fan.

  2. Ben says:

    Hey there,

    Thanks for this tutorial :) One question though…which files are you referring to when you say ‘upload backup files’? I wasn’t sure….so I’m currently just uploading the entire folder and replacing the files that were put there but the auto install I did on the domain using cPanel.

    • Hi Ben,

      Doing the auto-install isn’t a problem and when you are backing up your site I mean you download the entire website. So go to the root directory of your site and download everything to your computer, then edit the config files as above and follow the steps.

      Let me know if it goes alright!

      Cheers,

      Jack

  3. Ian says:

    Hi Jack

    I originally installed my OpenCart on a free host. The store was working fine and I updated a few things (template, catagories, products etc). I have upgraded to a paid host and have done all of the above (I actually got the instructions from elsewhere but yours seem very easy to understand). I have now re-imported my database to the new host (all lines are in tact) but when I go to my store it hasn’t brought through anything apart from the ability to change the template to my new one when I go to ‘System/settings’.
    I have tried a new install on the new host a couple of times to see if I can work out where I am going wrong. I have also cleared and re-imported the database a number of times and I am about ready to break something!
    Please help
    Many thanks
    Ian

    • Hi Ian,

      Sorry for the delay, I’ve been away ill for a while so haven’t had a chance to get your comment. It is really tricky moving OpenCart from one server to another and free web hosts don’t make it easy for you to leave as they don’t make money from you.

      So, you say that your database has been imported fine so we’ll assume that it isn’t anything to do with that. I would say it is probably something to do with the connection to the database. I would recommend getting your web host to confirm your MySQL Hostname and double check that you are using your new MySQL database username and password in the config files. In the same file there will be a list of directories with a web address after them, make sure that you have your new domain name as the web address and that every URL has a “/” (slash) at the end of it.

      Are you getting an error message at all? Would you be able to share it and it might point me towards the source of the problem.

      Cheers,

      Jack

  4. Best bit of advice I have had in a long while, saved me time and Money! :-) x

  5. brian says:

    Hello, I am wondering when you click add to cart on this site and it takes 5-10 seconds to actually get to the cart is this from the server side since multiple clients from different ips are getting the same result? This just started happening with no code modifications. Thanks in advance! site url is wedgewoodpizzaboardman.biz

    • Hi Brian,

      This is a fairly common problem across OpenCart and unfortunately it can be caused from so many different things that it is impossible to speculate here. You could try getting in touch with the theme designer and see if there is a fix as they probably have solved the issue with other clients. It is usually something to do with the AJAX call.

      Let me know how you get on!

      Cheers,

      Jack

  6. Andrew says:

    Re: Moving an Opencart site to another host.

    Currently in the middle of this process. I dont have access to the FTP so its taking time to recreate it on the new hosting package I have set up – just a simple hosting package at Fasthosts but the domain has NOT been transferred or anything yet.

    One thing I just thought of is when we finally do get ready to point domain at new host, all about the downtime etc. Its a .com so I think it takes up to 10 days to change domain pointing to another host?? The site wont be down as such since one day it will be pointing to “old” host and then one day the “new” host. However, people will no doubt be ordering stuff in the mean time and it wont be known exactly when the site will be looking at new hosting. Potentially orders will be lost??

    THoughts? Suggestions?

    • Hi Andrew,

      Don’t worry about the FTP, just create a ZIP file through your website file manager and download your entire OpenCart store all at once. Then upload and reconnect your database at the new hosting account and you will have two versions, then all customers will see a store no matter what while the DNS propagates. You may have to move any orders you get on the old store to the new one but at least you won’t have lost any.

      Cheers,

      Jack

  7. Jon says:

    Hi Jack,

    When the database is moved- what do I need to do the the original user name and password? Do I update the config files with this data too?

    Thanks
    Jon

  8. Stephen says:

    This is just what i’ve been looking for! I can now move some of my customers to a single hosting package. Thanks!

  9. Jacqueline says:

    Thanks for this. But when i’d clicked import…. it says

    MySQL said:

    #1007 – Can’t create database ‘camerali_estore’; database exists

    • It sounds like you have already created the database, trying going back to your old database and exporting all the tables rather than the database and give it another shot.

      Cheers,

      Jack

  10. Stefan Taylor says:

    Hi Jack

    I’ve managed all of the above, but all I get on my shop is a whole page these:

    Warning: unlink(D:vhostsbusinessnamethatcantbebroadcastshop/system/cache/cache.country.1354057122) [function.unlink]: Permission denied in D:vhostsbusinessnamethatcantbebroadcastshopsystemlibrarycache.php on line 14

    Please help me!!

    • Hi Stefan,

      It is a permissions error, it can happen when moving across different hosting accounts. Open up your site in an FTP client like Filezilla and select all the root directories and files. Set all the permissions to 755, remember to click “recurse into subdirectories”. After it is done set the config.php and admin/config.php permission to 644.

      If it still doesn’t work, repeat but set permissions to 777. Let us know how you get on.

      Cheers,

      Jack

  11. Tony says:

    Hi Jack,

    I am having problems and I do think it is a mysql issue but I am not sure.

    I followed all the instructions in relation to the exporting and importing the database which was successful. Before I complete the transfer I setup the domain at http://drinkingwatersolutions.co.s47865.gridserver.com/ and I get errors.

    Can you help me to resolve this issue.

    Cheers
    Tony

    • Hi Tony,

      It isn’t a MySQL problem by the look of it, it seems that your file path isn’t resolving. Open up config.php and admin/config.php and make sure that the file structure is correct. You can try changing “C:inetpubvhosts” to “/nfs/c03/h06/mnt/47865/domains/” and it should start working. It looks like it still using the C drive path for OpenCart, perhaps when you were working on it on your computer?

      Cheers,

      Jack

  12. Tony says:

    Hi Jack,

    Thank you for your quick response and yes you were quite correct it works fine now… :o)

    Cheers
    Tony

  13. Zoli says:

    Hi Jack,

    I am having this problem with my site:

    Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/run/uzemanyagcsokkento.hu/html/webaruhaz/system/library/log.php on line 16
    Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘/var/www/run/uzemanyagcsokkento.hu/html/webaruhaz/image/cache/data/flash-150×104.jpg’ for writing: Permission denied in /var/www/run/uzemanyagcsokkento.hu/html/webaruhaz/system/library/image.php on line 45
    Warning: fopen(/var/www/run/uzemanyagcsokkento.hu/html/webaruhaz/system/logs/error.txt) [function.fopen]: failed to open stream: Permission denied in /var/www/run/uzemanyagcsokkento.hu/html/webaruhaz/system/library/log.php on line 12

    I don’t know what is wrong, but i hope you can help me.

    Thank you!
    Zoli

    • Hi Zoli,

      It looks like a permissions problem, set everything to 755 using an FTP agent like FileZilla but make sure to set the config.php and admin/config.php to 644 in order to protect your site. If the error persists, set everything to 777 (except config files again).

      Cheers,

      Jack

  14. Sean Wilkus says:

    Hi Jack,

    Getting this error when going the the 50.62.74.20 website. DNS is not running yet on the new Dedicated Virtual Server but it was working before. Any Ideas? Thanks. Sean.

    Warning: require_once(): open_basedir restriction in effect. File(/var/www/vhosts/50.62.74.20/httpdocs/system/startup.php) is not within the allowed path(s): (/var/www/vhosts/nextinnovations.net/:/tmp/) in /var/www/vhosts/nextinnovations.net/httpdocs/index.php on line 19 Warning: require_once(/var/www/vhosts/50.62.74.20/httpdocs/system/startup.php): failed to open stream: Operation not permitted in /var/www/vhosts/nextinnovations.net/httpdocs/index.php on line 19 Fatal error: require_once(): Failed opening required ‘/var/www/vhosts/50.62.74.20/httpdocs/system/startup.php’ (include_path=’.:’) in /var/www/vhosts/nextinnovations.net/httpdocs/index.php on line 19

    • Hi Sean,

      Sounds like you have PHP Safe Mode turned on. You can turn it off with a php.ini file but if you’re not sure then create a new file called myinfo.php and insert the following code into it:

      <?php
      
      phpinfo();
      
      ?>
      

      Then upload it to your store folder and navigate to it in your browser. Run a quick search for “safe_mode” and see if it’s turned on. You may have to ask your web host to turn if off their end. Don’t forget to delete the myinfo.php file when your done with it, you don’t want spammers to know your server settings.

      Cheers,

      Jack

  15. Michelle says:

    Hi Jack-

    Very easy and simple tutorial…. :)

    But I went through your step by step process and the site is not showing up. I originally set the opencart site up through godaddy and moved it to ipage. Registered domain name and purchased webhost account today. Tested site by uploading a basic test index.html file and the site updated right away so it’s not a delay.

    The only thing that would load is the default webhost home page and the default error page. I deleted the default home page and now it goes directly to the error page.

    I had to rename my database when I imported to ipage, but I changed the config and admin/config files to reflect correct database name.

    Am I missing a file to tell it to load my stores home page?

    Any help would be appreciated.

    • Hi Michelle,

      Sounds like an issue with your web hosting rather than your OpenCart installation. Are you using an SSL certificate, they can sometimes cause the default page to show up.

      Cheers,

      Jack

  16. Jenn says:

    My original website is poolmats.net but every time I try to import the database, I get the following error below. Any idea what I’m doing wrong?

    Error

    SQL query:


    – Database: `xxxxxx` (xxxxxx = the original database name)

    – ——————————————————–

    – Table structure for table `oc_address`

    CREATE TABLE IF NOT EXISTS `oc_address` (
    `address_id` int( 11 ) NOT NULL AUTO_INCREMENT ,
    `customer_id` int( 11 ) NOT NULL ,
    `firstname` varchar( 32 ) COLLATE utf8_bin NOT NULL DEFAULT ”,
    `lastname` varchar( 32 ) COLLATE utf8_bin NOT NULL DEFAULT ”,
    `company` varchar( 32 ) COLLATE utf8_bin NOT NULL ,
    `company_id` varchar( 32 ) COLLATE utf8_bin NOT NULL ,
    `tax_id` varchar( 32 ) COLLATE utf8_bin NOT NULL ,
    `address_1` varchar( 128 ) COLLATE utf8_bin NOT NULL ,
    `address_2` varchar( 128 ) COLLATE utf8_bin NOT NULL ,
    `city` varchar( 128 ) COLLATE utf8_bin NOT NULL ,
    `postcode` varchar( 10 ) COLLATE utf8_bin NOT NULL ,
    `country_id` int( 11 ) NOT NULL DEFAULT ’0′,
    `zone_id` int( 11 ) NOT NULL DEFAULT ’0′,
    PRIMARY KEY ( `address_id` ) ,
    KEY `customer_id` ( `customer_id` )
    ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin AUTO_INCREMENT =17;

    MySQL said: Documentation
    #1046 – No database selected

    • Make sure in phpMyAdmin that you have “localhost” showing at the top, not the name of the table. It sounds like you have imported the table rows to be imported into another table of the same name which won’t exist on your new server.

      Cheers,

      Jack

  17. Peter B says:

    Hé Jack,

    I made a backup with Anyport. This software makes a total backup of all files and database. I then made a Restore on my local Xamp folder. So my goal is to have a local version of my website to test on before doing things live.

    After the restore and changing the configs however there is no data in System – Settings (it is default again).

    Where is this info stored and what could have gone wrong?

    • Hi Peter,

      Do you have a couple of default installations on the server? Perhaps the software is backing up the wrong database as all that info is stored in the “settings” table in the database. You can check it is the correct database backup by looking in your config.php files and seeing if the database name matches.

      Let me know how you get on.

      Cheers,

      Jack

  18. Serkan Görmüs says:

    hello,

    I want to copy my shop to an other domain, but this domain will be a subdomain….

    example: http://www.my-old-domain.com —-> http://www.shop.my-new-domain.com

    How would that works, I get error on my site… and can not login to the admin area… the frontend doesnt appear…

  19. Laura says:

    I am moving a test website from my own hosting and domain to a client’s domain, which has a test web address at present until they decide to swap over from their existing zencart store. I have tried to swap it over and followed your instructions, made sure the safe mode is off, all permissions are right and I am still getting this message.

    Warning: require_once(/system/startup.php) [function.require-once]: failed to open stream: No such file or directory in /home/theduckc/public_html/index.php on line 15

    Fatal error: require_once() [function.require]: Failed opening required ‘/system/startup.php’ (include_path=’.:/usr/lib/php’) in /home/theduckc/public_html/index.php on line 15

    Any ideas? I am at my wits end!

    • Hi Laura,

      It sounds like the filepath is incorrect in your config.php files. Open up a new file and type in <?phpinfo(); ?>, save it as info.php and upload to your root folder. Then go to http://www.YOUR SITE].com/info.php and look through until you find the actual filepath and use that in the config.

      What is happening is that your index.php file is being called up like any other site but the first thing it is doing is trying to start all the database queries and such. Which it can’t find because the filepath doesn’t lead the right files.

      Let me know how you get on

      Jack

  20. Amrit says:

    I have tried this a few time now, and every time I do it, I get this error:

    s:1:”0″; Fatal error: Class ‘Registry’ not found in /storage/content/76/104776/testsite.se/public_html/index.php on line 31

    I tried uploading the installer, but I just get the same error.
    I removed the vQmod, same error. (Though it is on line 27 now, ofcourse)
    Tried installing vQmod, same error.

    I just copied all the files, uploaded them on the same server, different directory.
    Kept the database as it is on the same webserver.

    Made all the appropriate changes in config.php and admin/config.php

    I am somewhat stumped.

    Any suggestions?

    • Hi Amrit,

      You’ll need to double check everything in your config.php and admin/config.php files. It sounds like the server information may be incorrect and it can’t find the PHP function. Check all the file paths if you’re adamant that you have the rest of the details absolutely correct, a missing backslash or misspelt word will mean an error will be called up.

      Cheers,

      Jack

  21. Alen says:

    hello, i have two domains, same host
    i have my original site and now a new one
    i want to know is it possible to install open cart again on new domain and just some how to copy my products and categories?
    thank you

    • Hi Allen,

      This is possible yep, just copy everything over the new folder. Export the database and create it again with a similar name, and just update the config files with the amended database details. Make sure you keep the DB HOST detail the same across both of the sites.

      Cheers,

      Jack

  22. ned says:

    i get the following error after importing the database to the new site cpanel:
    Error
    SQL query:

    – — Database: `(databas name-prefix)` — – ——————————————————– — – Table structure for table `password1Hxxaddress` — CREATE TABLE IF NOT EXISTS `password1Hxxaddress` ( `address_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `firstname` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT ”, `lastname` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT ”, `company` varchar(32) COLLATE utf8_bin NOT NULL, `company_id` varchar(32) COLLATE utf8_bin NOT NULL, `tax_id` varchar(32) COLLATE utf8_bin NOT NULL, `address_1` varchar(128) COLLATE utf8_bin NOT NULL, `address_2` varchar(128) COLLATE utf8_bin NOT NULL, `city` varchar(128) COLLATE utf8_bin NOT NULL, `postcode` varchar(10) COLLATE utf8_bin NOT NULL, `country_id` int(11) NOT NULL DEFAULT ’0′, `zone_id` int(11) NOT NULL DEFAULT ’0′, PRIMARY KEY (`address_id`), KEY `customer_id` (`customer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREME[...]

    MySQL said:

    #1046 – No database selected

    • Hi Ned,

      Make sure that the table you are importing does not exist already. When you’re exporting the old database go right back to the database root, in PHPMyAdmin you can see a line of links along the top, these breadcrumbs show you where you are, make sure you’re not just importing the table itself because it won’t be able to find it in the new server.

      Cheers,

      Jack

  23. afiq arbae says:

    Hi, i got this error. Can you help me?

    Warning: require_once(/home/imanaman/public_html/system/startup.php): failed to open stream: No such file or directory in /home/imanaman/public_html/crazewear.com.my/index.php on line 19

    Fatal error: require_once(): Failed opening required ‘/home/imanaman/public_html/system/startup.php’ (include_path=’.:/usr/local/lib/php’) in /home/imanaman/public_html/crazewear.com.my/index.php on line 19

    • Hi,

      Check your file paths in the config.php and admin/config.php. It sounds like they are incorrect so it is trying to open a file it can’t find. Hope this helps :)

      Cheers,

      Jack

  24. Bronte Ward says:

    Hi, I found your detailed instructions and followed all steps accordingly.
    I am new to websites and went through your instruction very slowly and the db seemed to import just fine.
    I went through the config files carefully and made the appropriate changes, but when I try to bring up the site yesterday, I get the following errors….
    Warning: require_once(/system/startup.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/96/7111296/html/index.php on line 21

    Fatal error: require_once() [function.require]: Failed opening required ‘/system/startup.php’ (include_path=’.:/usr/local/php5/lib/php’) in /home/content/96/7111296/html/index.php on line 21

    I hope you can please help me.

    • Hi Bronte,

      Looks like your OpenCart store filepath is incorrect. In the config.php and admin/config.php make sure when it is defining the directories that the correct filepath is used. If you are switching between two different servers then it will almost certainly be different to before.

      Cheers,

      Jack

  25. Aurelie says:

    (the url provided show my current website, because opencart doesn’t work and I cannot not be live)

    Hi Jack,
    Thank you for well detailed tutorial. There are not so many tutorials included already built database.

    My situation is the following : I have built the website locally using Mamp. When I was ready to go live, I :
    * Created a new database
    * Imported via Php My admin the information into this new database
    * I installed Opencart to my server linking to the new database
    * Had the installation success message
    I have access to backend and frontend with no specific error message but it shows the demo opencart. None of my database information is displayed. I’ve tried to re-install, create another database, change the password to a letter/number type … and have no idea what I can do next. My config files seem to show the correct information.

    Any clue would be gladly appreciated :)

    Thanks in advance
    Aurelie

    • Jack Davis says:

      Hmm, very strange. I would say that you must be linking to the wrong database somewhere along the way or your database didn’t import properly. A few times in the past I have not imported something correctly but the error message isn’t (or wasn’t) obvious so I never realised it had failed.

      If it is showing the demo data but the store is working, I would say that it must be the right database isn’t connected correctly.

      Thanks,

      Jack

  26. Hurray…!
    I have successfully transferred my website to a new domain…
    Thanks a lot!

  27. clio says:

    Hi Jack, while I was importing the sqldatabase file onto my new domain, i received the following error message:
    Error

    SQL query:


    – Database: `information_schema`

    CREATE DATABASE `information_schema` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

    MySQL said: Documentation
    #1044 – Access denied for user ‘sunnyday’@'localhost’ to database ‘information_schema’

    any advice?

    thanks!

  28. clio says:

    Hi Jack,

    in addition to that,

    after I have backed up all the original files under public_html in my previous domain and upload everything to the new domain, I received the following error message when trying to launch the site under the new domain:

    Warning: require_once(/home/sunnyday/public_html/system/startup.php) [function.require-once]: failed to open stream: No such file or directory in /home/sunnyday/public_html/sunnyday.com.sg/index.php on line 19

    Fatal error: require_once() [function.require]: Failed opening required ‘/home/sunnyday/public_html/system/startup.php’ (include_path=’.:/usr/lib/php’) in /home/sunnyday/public_html/sunnyday.com.sg/index.php on line 19

    are you able to advise?

    thanks!

    • Looks like you have put the wrong filepaths into the config.php and admin/config.php. Have a look through the other comments, I’ve written a solution in a few :)

      Cheers,

      Jack

  29. Imani says:

    Hey.. thank for your posting by the way..very nice! I’m having a bit of a problem though.. I followed the steps exactly and when I go to the page I get the following error message:

    Warning: require_once(/system/startup.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/30/10392530/html/index.php on line 17

    Fatal error: require_once() [function.require]: Failed opening required ‘/system/startup.php’ (include_path=’.:/usr/local/php5_3/lib/php’) in /home/content/30/10392530/html/index.php on line 17

    …any idea on what happened??

    Thanks,
    Imani

  30. Imani says:

    …REGARDING LAST POST…

    PLEASE HELP!!! PLEASE RESPOND!!!

    • It looks like your filepath isn’t correct in the DEFINE sections. Add a new file to the root folder of OpenCart, add the text < ?phpinfo(); ?> and name the file info.php. The look through the file to get the right filepath and update your config.php and admin/config.php files accordingly.

      Cheers,

      Jack

  31. billy noah says:

    hey thanks for the tutorial. actually i found it a bit too late since i just trudged through this process a bit blind, but succeeded in the end. one pitfall i will mention that came up for me was a permissions problem.

    my new host (hostgator) was throwing 500 internal server error due to the fact that i had (perhaps in a desperate attempt to solve some other permissions problem) set my entire opencart installation permissions to 777. you’d think this would be just fine but not so. hostgator (and perhaps other commercial hosting services) saw this as a security vulnerability. i chmod’d the whole install to 755 and now it’s working.

    hope this helps someone.

  32. Huy says:

    I have issue when moving opencart to another domain. Everything work fine except SEO. The old SEO is work correctly.

    .htaccess is the same with the old. So, anything that I need to change?

    Setting -> Server -> SEO Friendly (done!)
    .htaccess is the same (!done) :(

    Thanks,
    Huy

    • Jack Davis says:

      Hi Huy,

      That is strange! It could be that your new web hosting provider doesn’t allow .htaccess URL ReWriting, you could try getting in touch with them to check you are allowed to use it on your account.

      Another thing you could check is whether the root folder is correct. For example, if you are moving from a URL where your store is in a sub domain like http://www.DOMAINNAME.com/store then then.htaccess file will have /store/ as the root folder in the file. Make sure that that sub folder is correct on the new domain or leave it at “/” (without the quotation marks) if it is just installed at http://www.DOMAINNAME.com.

      Thanks,

      Jack

  33. Frank says:

    Hi Jack,
    Thanks for this tutorial but I may have done something wrong
    This is what i get after doing what you said:

    Warning: require_once(/system/startup.php): failed to open stream: No such file or directory in /homepages/2/d4000000000/htdocs/index.php on line 17

    Fatal error: require_once(): Failed opening required ‘/system/startup.php’ (include_path=’.:/usr/lib/php6′) in /homepages/2/d400000000/htdocs/index.php on line 17

    What should I do ?
    Thanks for your help and good luck to your business.

    • Jack Davis says:

      Hi Frank,

      It looks like your filepaths are not correct, it is looking in the wrong folder for the startup scripts. Create a file called info.php on your domain name and just write the line <?phpinfo(); ?> in it, then go to the file in a browser so http://www.YOUR DOMAIN NAME].com/info.php and perform a “Find” on your page to look for “Filepath”. Make sure this is correct on your config.php files.

      Let me know how you get on!

      Thanks,

      Jack

    • Frank says:

      Okay so I just did so and on mydomain.com/info.php
      This is what appears:

      Meaning just the text I entered ..
      What’s wrong ?

    • Frank says:

      I’m sorry,
      I just saw you replied to previous messages on this error
      But I still can’t figure out which file should I change ?
      What does homepages/2/ etc stands for ?
      I have no such things in my FTP
      Hope you can help.

  34. Frank says:

    Wow again sorry, didn’t saw your reply lol
    You can delete the previous message, I’ll do what you just said and let you know.
    Thanks

  35. Frank says:

    Okay, just did it.
    Thanks Jack
    For those that have the same issues:
    For example you have:

    Warning: require_once(/system/startup.php): failed to open stream: No such file or directory in /homepages/2/d4000000000/htdocs/index.php on line 17

    In your config file, simply put ”/homepages/2/d4000000000/htdocs/” before the first ”/”

  36. I just migrated my site and took about a week to test it and update a few things and I want to make it live but in the last week the client has made many adjustments to inventory and sold many things. Is there an easy way to go to the original files on the old server and get the changes and incorporate them?

    • Jack Davis says:

      Hi Ed,

      Hmm, depends on what changes you’ve made to the store. If they don’t affect the database then you might be able to just export the database and import on the top of the test site. Otherwise, you might have to go into the updated tables and manually export the new rows to add to the test site.

      Cheers,

      Jack

  37. Geekyard says:

    Cool article buddy :) I will try to follow your steps to copy the DB for my clients instead of building everything from scratch ;)

  38. Donna says:

    Hello, I am trying to set up a development copy of my store in a subdomain eg dev.mydomain.co.uk. I have successfully transferred all the files and made the changes to the paths in the 2 config files, however when I try to log in to the admin panel from within the new subdomain it reverts to mydomain.co.uk/admin rather than dev.mydomain/admin so I cannot log in to the admin of my new copy. Can you help at all? Thanks.

    • Hi Donna,

      Make sure you change the HTTP_SERVER and HTTPS_SERVER definitions in both config.php files when you move it otherwise it will still look at the original store.

      Thanks,

      Jack

  39. manon says:


    Warning: require_once(/homepages/21/db495325750/htdocs/system/startup.php): failed to open stream: No such file or directory in /homepages/21/d490672313/htdocs/index.php on line 19

    Fatal error: require_once(): Failed opening required ‘/homepages/21/db495325750/htdocs/system/startup.php’ (include_path=’.:/usr/lib/php6′) in /homepages/21/d490672313/htdocs/index.php on line 19

    I read all your responses and tried to apply but nothing works.
    Help me

    • Jack Davis says:

      Hi Manon,

      It looks like the filepaths in your config.php files are not correct. Maybe get in touch with your hosting provider and ask them for clarification if your are certain the info.php file is giving you the URL you’re using. Also, if you’re moving it from a local development area to a web server, make sure that you turn the slashes back the other way.

      Thanks,

      Jack

  40. Omar Noorzay says:

    I just fond your instruction and it looks pretty straight forward.

    I have moved my shopping webstore from paylesssavemore.com to bjjproducts.com I am not sure what is going wrong because I can see all my products on the back end but on the front end of my store I don’t see anything. What am I doing wrong and what can I do to fix this.

    Thanks,
    Omar

  41. indra says:

    my website based on open cart has many trouble, so many error log. So my plan to cloning all data base from product etc to a new open cart installation, are this is working?

  42. indra says:

    i forgot, i used open cart version 1.5.6. my aim is, all function on open cart back to normal, no error log. can i do this clone?

    • Jack Davis says:

      Hi Indra,

      I think you need a developer to have a look through the code and try to remove the source of the problem. Moving everything to a new domain is probably not going to fix it unless you have made changes to the theme and you’re planning on installing it fresh. Get in touch if you want me to work out what is going wrong!

      Thanks,

      Jack

  43. Monika says:

    Dear Jack

    I have to shift from one cpanel to another. I have the Backup file in tar.zp and sql of my opencart file. I want to restore my site. Can you give me the brief step to follow for the Next cpanel before upload and after upload the data. I am tired by several time delete and restore the data. Still getting Index of/ error in place of my webstore.

    Please help
    Monika

    • Jack Davis says:

      Hi Monika,

      At that stage you will need to login to your File Manager and extract the tar file to restore all of the original files and then update the config.php files.

      Thanks,

      Jack

  44. Ryan Ramsey says:

    Hi Jack!

    Very nice of you to help all these people out. Maybe you can help me…

    I’ve successfully uploaded my Database to a new hosting account and have updated both config files with the database info and new hosting paths. Unfortunately I am getting the following error:

    Notice: Error: Could not connect to database sbvideos_db in /home4/sbvideos/public_html/system/database/mysql.php on line 11

    Notice: Error: No database selected
    Error No: 1046
    SELECT * FROM store WHERE REPLACE(`url`, ‘www.’, ”) = ‘http://softballvideos.com/’ in /home4/sbvideos/public_html/system/database/mysql.php on line 50

    The site is working properly on it’s existing host right now but they are not PCI compliant so I have to move.

    Thanks in advance for any advice!
    Ryan

    • Hi Ryan,

      Have you definitely double check the database name, user account and password are correct? It doesn’t seem to like it. There are some web hosts which allow the use of ‘localhost’ but some, like GoDaddy require a specific domain name in the host section. I would say from the above that your filepaths are correct it just can’t seem to be able to login to the database. Also, ensure that the user account has the right privileges in phpMyAdmin.

      Thanks,

      Jack

  45. Ulf says:

    Hi Jack
    I read your excellent post on how to move the OpenCart shop to another server and domain.
    Thank’s a lot!

    There are a few things I wonder about according to this matter;

    Will the OpenCart admin name and password
    remain the same on the new site as in the
    original one?

    Will I be able to use the new clone site as a test site, ie. making changes to it without interfering the original site?

    If I keep the clone site in maintain mode will
    it prevent Google from finding it and there by
    keep the original site at level?

    Thank’s again,

    Ulf

    • Hi,

      Yep the two sites will run independently of each other so you can make changes to one and use it as a test environment. The password and login info will remain the same.

      With regards to stopping Google indexing the site, I’d recommend using a robots.txt file to stop it appearing in search results. A quick Google search (ironically) will show you how to do it.

      Glad you found the post useful!

      Jack

  46. Ulf says:

    Cheers!

    Ulf

  47. Ulf says:

    Hi Jack,

    Have now moved the site to a new web host to use it as a test site.
    The front end seem alright though it’s in maintain mode (transferred that way).

    Have the following problem; can’t log in to back end.

    *When using a phony username/password and press “login” button
    the phony username/password text remains in thier fields
    and the “No match for Username and/or Password” sign pops up,as it should.*

    But, when using the correct username/password and press “login” button
    the username/password textfields goes empty and thats it, the login
    side remain and there is no error message either?

    If again go through above *-* the same again, etc, etc.

    Wounder if you might have any idea to the cause of this issue.

    Most thankful to any answer!

    Ulf

  48. Ulf says:

    Hi again,
    Problem solved, it was a session issue.
    Learning by doing :-)
    Cheers!
    Ulf

  49. Anthony says:

    Hi Jack.

    I have tried now to move my site to a new web host & domain. However, whenever I try to access links in the Home page (e.g About, Contact Us, etc.), it redirects back to Home page. I could not access the product pages either.

    I have properly done the config.php settings and restored the database from the old host. What seems to be the problem? Thanks.

    • Jack says:

      Hi Anthony,

      Very strange, could you post a link to the site? The URL you submitted with the comment appears fine :)

      Thanks,

      Jack

  50. Ryan Taxis says:

    I’d like to do this, and I did read the comments, but I still have a question:

    I want to create a copy of our store on a separate domain (with private login), for our wholesale customers.

    Should I presume that I do it the exact same way, but create a new database and use those parameters for it instead of using the old database, which will still be in use with our original public store and domain?

    I’m also going to put it in a subdomain or subfolder so I can have the main .com only be a login screen.

    Thanks for the guide…this is the best one I’ve seen yet after reading countless instructions in the forums that are anything but step-by-step.

    • Jack says:

      Hi Ryan,

      Yep follow the guide to the letter but just don’t delete your old store and create your new database. Had a few people in the past who wanted me to move it but keep the original in order to split the site and use one for wholesale and one for retail etc so it’s very easy. Might be worth looking into the multi-site functionality of OpenCart first though as it could potentially be a much easier way to manage two stores (if I haven’t misunderstood what you’re after that is :))

      http://www.opencart.com/index.php?route=feature/feature&path=4

      Thanks,

      Jack

  51. Monika says:

    Dear Jack

    After Moving my site on another cpanel. Vqmod installed is unable to work. And every time showing some permission miss. I have tried all the perimissions and all the way to correct vqmod. How I delete Old Vqmod and install a fresh? I even tried this also but not succeed. Can u please suggest me how I can correct it.

    http://www.mtjcart.com

    Thanks
    Monika

    • Jack says:

      Hi Monika,

      Installing vqMod makes changes to different files like index.php so I think it is a little tricky to uninstall. What exactly are the errors? In the past I had a permission error when trying 755 or 777 and I managed to get around it by using FileZilla, deleting the mods.cache file and simply creating a new file with exactly the same name.

      Hope this helps!

      Jack

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>