Sunday, March 03, 2013

Migrate opencart from local to server

Migrate opencart from local to server

Step 1: Backup database from local server.
Step 2: Backup OpenCart shop folder from local server.
Step 3: Create and import database to hosting server.
Step 4: Copy OpenCart shop folder contents to server, where your domain points to.
Step 5: Update configuration files.
Here is the interesting part:
In the root folder and admin folder of your newly copied OpenCart website, you will see that both have a config.php file. Open them both in your favorite code editor. Intially, this is what they might look like:
root folder:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// HTTP
define('HTTP_SERVER', 'http://localhost/merchant/');
define('HTTP_IMAGE', 'http://localhost/merchant/image/');
define('HTTP_ADMIN', 'http://localhost/merchant/admin/');
// HTTPS
define('HTTPS_SERVER', 'http://localhost/merchant/');
define('HTTPS_IMAGE', 'http://localhost/merchant/image/');
// DIR
define('DIR_APPLICATION', 'C:\xampp\htdocs\merchant/catalog/');
define('DIR_SYSTEM', 'C:\xampp\htdocs\merchant/system/');
define('DIR_DATABASE', 'C:\xampp\htdocs\merchant/system/database/');
define('DIR_LANGUAGE', 'C:\xampp\htdocs\merchant/catalog/language/');
define('DIR_TEMPLATE', 'C:\xampp\htdocs\merchant/catalog/view/theme/');
define('DIR_CONFIG', 'C:\xampp\htdocs\merchant/system/config/');
define('DIR_IMAGE', 'C:\xampp\htdocs\merchant/image/');
define('DIR_CACHE', 'C:\xampp\htdocs\merchant/system/cache/');
define('DIR_DOWNLOAD', 'C:\xampp\htdocs\merchant/download/');
define('DIR_LOGS', 'C:\xampp\htdocs\merchant/system/logs/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_DATABASE', 'merchant_db');
define('DB_PREFIX', '');
?>
admin folder:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// HTTP
define('HTTP_SERVER', 'http://localhost/merchant/admin/');
define('HTTP_CATALOG', 'http://localhost/merchant/');
define('HTTP_IMAGE', 'http://localhost/merchant/image/');
// HTTPS
define('HTTPS_SERVER', 'http://localhost/merchant/admin/');
define('HTTPS_IMAGE', 'http://localhost/merchant/image/');
// DIR
define('DIR_APPLICATION', 'C:\xampp\htdocs\merchant/admin/');
define('DIR_SYSTEM', 'C:\xampp\htdocs\merchant/system/');
define('DIR_DATABASE', 'C:\xampp\htdocs\merchant/system/database/');
define('DIR_LANGUAGE', 'C:\xampp\htdocs\merchant/admin/language/');
define('DIR_TEMPLATE', 'C:\xampp\htdocs\merchant/admin/view/template/');
define('DIR_CONFIG', 'C:\xampp\htdocs\merchant/system/config/');
define('DIR_IMAGE', 'C:\xampp\htdocs\merchant/image/');
define('DIR_CACHE', 'C:\xampp\htdocs\merchant/system/cache/');
define('DIR_DOWNLOAD', 'C:\xampp\htdocs\merchant/download/');
define('DIR_LOGS', 'C:\xampp\htdocs\merchant/system/logs/');
define('DIR_CATALOG', 'C:\xampp\htdocs\merchant/catalog/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_DATABASE', 'merchant_db');
define('DB_PREFIX', '');
?>
In the example above we can see that the store used xampp and the folder that contained it was located at C:\xampp\htdocs\. Also notice that the slashes are backwards (under //DIR block). This detail is especially important if you are transferring from public server to local. To complete the migration, simply change the directories of the constants defined in the configuration files such that it will look something like these:
root folder:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// HTTP
define('HTTP_SERVER', 'http://yourdomain.com/');
define('HTTP_IMAGE', 'http://yourdomain.com/image/');
define('HTTP_ADMIN', 'http://yourdomain.com/admin/');
// HTTPS
define('HTTPS_SERVER', 'http://yourdomain.com/');
define('HTTPS_IMAGE', 'http://yourdomain.com/image/');
// DIR
define('DIR_APPLICATION', '/home/your_hosting/public_html/catalog/');
define('DIR_SYSTEM', '/home/your_hosting/public_html/system/');
define('DIR_DATABASE', '/home/your_hosting/public_html/system/database/');
define('DIR_LANGUAGE', '/home/your_hosting/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home/your_hosting/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home/your_hosting/public_html/system/config/');
define('DIR_IMAGE', '/home/your_hosting/public_html/image/');
define('DIR_CACHE', '/home/your_hosting/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/your_hosting/public_html/download/');
define('DIR_LOGS', '/home/your_hosting/public_html/system/logs/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'your_hosting_database_username');
define('DB_PASSWORD', 'your_hosting_database_password');
define('DB_DATABASE', 'your_hosting_database');
define('DB_PREFIX', '');
?>
admin folder:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// HTTP
define('HTTP_SERVER', 'http://yourdomain.com/admin/');
define('HTTP_CATALOG', 'http://yourdomain.com/');
define('HTTP_IMAGE', 'http://yourdomain.com/image/');
// HTTPS
define('HTTPS_SERVER', 'http://yourdomain.com/admin/');
define('HTTPS_IMAGE', 'http://yourdomain.com/image/');
// DIR
define('DIR_APPLICATION', '/home/your_hosting/public_html/admin/');
define('DIR_SYSTEM', '/home/your_hosting/public_html/system/');
define('DIR_DATABASE', '/home/your_hosting/public_html/system/database/');
define('DIR_LANGUAGE', '/home/your_hosting/public_html/admin/language/');
define('DIR_TEMPLATE', '/home/your_hosting/public_html/admin/view/template/');
define('DIR_CONFIG', '/home/your_hosting/public_html/system/config/');
define('DIR_IMAGE', '/home/your_hosting/public_html/image/');
define('DIR_CACHE', '/home/your_hosting/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/your_hosting/public_html/download/');
define('DIR_LOGS', '/home/your_hosting/public_html/system/logs/');
define('DIR_CATALOG', '/home/your_hosting/public_html/catalog/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'your_hosting_database_username');
define('DB_PASSWORD', 'your_hosting_database_password');
define('DB_DATABASE', 'your_hosting_database');
define('DB_PREFIX', '');
?>

Migrate opencart from local to server Rating: 4.5 Diposkan Oleh: Rumah Minimalis

0 komentar: