open cart
The first thing we need to do is backup your website files. Open up FileZilla (or your favorite FTP program) and enter your current host's FTP Host, username and password into the top boxes then click the Quickconnect button. If you don't know what these settings are then you can usually find them in your control panel with your current hosting company. Failing that, you can contact your host and ask them for these.
Once connected, you will need to navigate to where your OpenCart website is located. This is usually in your public folder called Public_html or Htdocs. If you installed your OpenCart website into a sub folder e.g. yourwebsite.co.uk/shop, then you will need to find your 'shop' folder.
Double click on your public folder to open it.
You should now see your website's files. We need to double check you are in the correct folder for your OpenCart files. Look for the below three files. If you can see these you are in the correct location.
- config.php
- hide_config_files.php
- index.php
If you can't see these files then you will need to look inside your other folders. If you installed your OpenCart store in a sub folder e.g. yourdomain.co.uk/shop then look for your 'shop' folder and double click it to open it. Then look for the above files.
Once you are in the correct location, you will need to select all the files and folders. To do this, left click once on config.php and press the 'CTRL' button and the 'A' key at the same time (command-A on a Mac). This will change all the files to be selected. You can now drag the files into a folder of your choice (left click on one file and drag them over a folder on your computer). We suggest having a folder on your desktop called 'old website' and downloading the files into here.
You will see a lot of connection and download text show in the top bar. Once this has stopped you should have all your OpenCart files downloaded to your computer.
Next, we need to download a copy of your OpenCart database. To do this, we will use phpMyAdmin. You will need to contact your current host and ask them for instructions on how to access phpMyAdmin for your database. Usually this will be under your control panel in a manage MySQL databases section.
Once in phpMyAdmin, click your database from the left hand menu.
You should see a list of tables related to open cart, starting with oc_ e.g. oc_address,oc_affiliate etc.
Next, click the export tab at the top.
Click the custom button then click the 'Select All' link to highlight all of the OpenCart tables.
Finally choose zipped from the 'Compression' drop down, then scroll down and click the 'Go' button.
You will be asked to save this to your computer. Make sure you remember where you save it to as you will need it later.
Step 2 : Upload your OpenCart Files to your new server
Now you have a copy of your website, we need to upload it and restore it on your new hosting/server. If you have purchased hosting with Squirrel Hosting then you can follow this guide exactly. If you're using another company for hosting, you will need to contact them for details on how to connect to your hosting via FTP and how to setup/connect to your database.
Open up FileZilla and connect to your new hosting company. Squirrel Hosting customers check your welcome e-mail for your FTP details. As your domain is still technically loading up your old hosting company at this stage, you will need to use the host's IP address instead of ftp.yourdomain to connect.
Double click on your public folder to open it up (for Squirrel Hosting customers, double click public_html).
Next, we need to upload all the files you downloaded in step 1 (do not upload your MySQL database).
To do this open up the folder where your files are stored and highlight them all, then drag them over onto your public folder.
Step 3 : Create a MySQL Database
Now we need to create a new database on your new hosting. This can vary depending on which hosting company you choose to use. For Squirrel Hosting customers, simply follow the below steps. For other hosting companies you will need to contact them and ask how to set up a MySQL Database. You will also need to make a note of the database hostname, username, password and database name then skip to step 4.
For Squirrel Hosting customers only, load up your eXtend control panel (see your welcome e-mail for details on how to do this) and click the MySQL Databases icon.
Next, enter your desired username in the username box and then click the 'Generate Password' button. Finally click Create.
Scroll down to the bottom of the page and under the 'Manage MySQL Databases' section you will see the database you have just created. Make a note of the following;
- Username (including any - )
- Password (hover over to view it)
Step 4 : Upload your OpenCart Database
We now need to load phpMyAdmin on your new hosting to import our OpenCart database. Again if you are with a company other than Squirrel Hosting you will need to contact them for details on how to access your database. For Squirrel Hosting customers, click the 'manage database' button under your 'MySQL databases' button in eXtend.
Once in phpMyAdmin, click your database menu on the left.
Click the 'Choose File' button and select the OpenCart database you made a backup of in step 1. Then scroll down to the bottom and click the 'Go' button.
This may take a few moments to process depending on how big your database is.
Once complete, you should see a message stating "Import has been successfully finished".
You have now restored your database and website files.
Step 6 : Update your config files
We now need to update your config.php and admin/config.php files to have the correct settings. You can either do this via FileZilla (FTP) or edit the files on your computer then upload them via FileZilla. If you do upload them, make sure they go in the correct location.
For the purpose of this guide, we will update them via FileZilla.
Open up FileZilla and connect to your new hosting package. Double click on your public folder (public_html). Next, right click on your config.php file and select 'View/Edit' (if you have installed your OpenCart in a sub folder, you will find your config file in there.)
The file should now open up for editing. In here you will need to edit a few lines of code. Find the lines:
// DIR
define('DIR_APPLICATION', '/home/sites/YOUR-DOMAIN/public_html/catalog/');
define('DIR_SYSTEM', '/home/sites/YOUR-DOMAIN/public_html/system/');
define('DIR_DATABASE', '/home/sites/YOUR-DOMAIN/public_html/system/database/');
define('DIR_LANGUAGE', '/home/sites/YOUR-DOMAIN/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home/sites/YOUR-DOMAIN/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home/sites/YOUR-DOMAIN/public_html/system/config/');
define('DIR_IMAGE', '/home/sites/YOUR-DOMAIN/public_html/image/');
define('DIR_CACHE', '/home/sites/YOUR-DOMAIN/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/sites/YOUR-DOMAIN/public_html/download/');
define('DIR_LOGS', '/home/sites/YOUR-DOMAIN/public_html/system/logs/');
You will need to update these to your correct path. Contact your hosting company for the full path to your public folder. (for Squirrel Hosting customers, use /home/sites/YOUR-DOMAIN/public_html/ . Make sure to replace YOUR-DOMAIN with your domain without the www. e.g. /home/sites/mywebsite.co.uk/public_html/)
Next, you need to update your database connection settings. Find the below:
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'your-old-opencart-databse-username');
define('DB_PASSWORD', 'your-old-opencart-databse-password);
define('DB_DATABASE', 'your-old-opencart-databse-database);
define('DB_PREFIX', 'oc_');
You will need to replace these with the new details made in step 3;
- DB_HOSTNAME = Your database host (usually localhost). Squirrel Hosting customers, use localhost here.
- DB_USERNAME = Your Database username.
- DB_PASSWORD = Your Database password
- DB_DATABASE = Your database name (Squirrel Hosting customers, use your database username here.)
Once you have updated these, save the file and click back to FileZilla. It will ask you if you wish to upload the file as it has changed. Click 'Yes' to this.
Next, we need to make the file 'read only' (CHMOD it to 444). On most servers, this is 444. To do this, right click on the config.php file again and click 'File Permissions'.
In the popup box, enter 444 in the number area then click 'OK'.
This file is now non editable. If you find you have made a mistake in what you have typed and you need to re-edit the file, you will need to re do this last step and enter 777. Make sure you DON'T leave this file CHMOD to 755 or you may leave your site open to hackers!
Next, we need to do the same edit with the admin/config.php file. Double click on your OpenCart admin folder.
As we did last time, right click on the config.php file and click 'View/Edit'.
As we did before, update the below to show your correct path.
// DIR
define('DIR_APPLICATION', '/home/sites/YOUR-DOMAIN/public_html/admin/');
define('DIR_SYSTEM', '/home/sites/YOUR-DOMAIN/public_html/system/');
define('DIR_DATABASE', '/home/sites/YOUR-DOMAIN/public_html/system/database/');
define('DIR_LANGUAGE', '/home/sites/YOUR-DOMAIN/public_html/admin/language/');
define('DIR_TEMPLATE', '/home/sites/YOUR-DOMAIN/public_html/admin/view/template/');
define('DIR_CONFIG', '/home/sites/YOUR-DOMAIN/public_html/system/config/');
define('DIR_IMAGE', '/home/sites/YOUR-DOMAIN/public_html/image/');
define('DIR_CACHE', '/home/sites/YOUR-DOMAIN/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/sites/YOUR-DOMAIN/public_html/download/');
define('DIR_LOGS', '/home/sites/YOUR-DOMAIN/public_html/system/logs/');
define('DIR_CATALOG', '/home/sites/YOUR-DOMAIN/public_html/catalog/');
Then edit your Database settings:
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'your-old-opencart-databse-username');
define('DB_PASSWORD', 'your-old-opencart-databse-password);
define('DB_DATABASE', 'your-old-opencart-databse-database);
define('DB_PREFIX', 'oc_');
Your database settings will be the same as you entered in your other config.php file earlier. Once edited save the file then confirm the upload on FileZilla.
Finally, CHMOD this file like you did with your other config.php (right click 'File Permissions') to 444.
- ۹۳/۱۰/۰۶