Difference between revisions of "X-Cart:Moving store to another host"

From X-Cart 4 Classic
Jump to: navigation, search
(Created page with 'In order to move your store from one host to another, you should take the following actions: 1. If your images are stored on the file system, move them to the database. This can…')
 
m
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
In order to move your store from one host to another, you should take the following actions:
+
To move your store from one host to another:
  
1. If your images are stored on the file system, move them to the database. This can be done under the ''''Images location'''' section of the admin interface.
+
1. {{XC 4.0}} If your images are stored on the file system, move them to the database. This can be done under the ''''Images location'''' section of the admin area.
  
[[Image:move2.gif]]'Images location' form
+
{{Note1| This step is necessary for 4.0.x and earlier versions only.
 +
See also: [[X-Cart:FAQs#How_do_I_know_which_version_of_X-Cart_I_use.3F | FAQs: How do I know which version of X-Cart I use?]]}}
  
 +
2. Backup the entire directory with your X-Cart based store; that's either the document root directory or one of its subdirectories. It is also recommended to delete the content of the <tt>'templates_c'</tt> directory before creating the backup file.
  
2. Backup the whole X-Cart directory. It is recommended to delete the content of the <tt>'templates_c'</tt> directory before creating the backup file.
+
{{Note1| For 4.0.x and earlier versions the <tt>'templates_c'</tt> directory is located in the root X-Cart directory. For 4.1.x and later versions - it is located within the <tt>'<xcart_dir>/var'</tt> directory.
 +
See also: [[X-Cart:FAQs#How_do_I_know_which_version_of_X-Cart_I_use.3F | FAQs: How do I know which version of X-Cart I use?]]}}
  
3. Backup the database. You can do it using either the ''''DB backup/restore'''' feature (see the corresponding section of the admin interface) or a MySQL terminal utility (like [http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html mysqldump] or [http://www.phpmyadmin.net/ phpMyAdmin]).
+
3. Backup the database. You can do that using either the ''''DB backup/restore'''' feature (see the corresponding section of the admin interface) or a MySQL terminal utility (like [http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html mysqldump] or [http://www.phpmyadmin.net/ phpMyAdmin]).
  
[[Image:move1.gif]]Database Backup/Restore' form
+
4. Upload the entire directory with your X-Cart based store to a web-accessible directory on the new server.
  
4. Upload the whole X-Cart directory into the web directory on the new server.
+
5. Edit the <tt>config.php</tt> file and adjust the settings related to your MySQL database account on the new host:
 
 
5. Edit the <tt>config.php</tt> file and adjust the settings which relate to your MySQL database account on the new host:
 
  
 
<pre>#
 
<pre>#
Line 26: Line 27:
 
</pre>
 
</pre>
  
6. Edit the <tt>config.php</tt> file and adjust the settings referred to the X-Cart HTTP & HTTPS host and web directory where it is to be installed:
+
6. Edit the <tt>config.php</tt> file and adjust the settings related to the X-Cart HTTP & HTTPS host and web directory where it is to be moved:
  
 
<pre>$xcart_http_host ="$HTTP_HOST";
 
<pre>$xcart_http_host ="$HTTP_HOST";
Line 44: Line 45:
 
- will result in the following URLs:
 
- will result in the following URLs:
  
<tt>http://www.yourhost.com/xcart
+
<tt>
https://www.securedirectories.com/yourhost.com/xcart</tt>
+
:http://www.yourhost.com/xcart
 +
:https://www.securedirectories.com/yourhost.com/xcart
 +
</tt>
  
 
EXAMPLE 2:
 
EXAMPLE 2:
Line 56: Line 59:
 
- will result in the following URLs:
 
- will result in the following URLs:
  
<tt>http://www.yourhost.com/
+
<tt>
https://www.yourhost.com/</tt>
+
:http://www.yourhost.com/
 +
:https://www.yourhost.com/
 +
</tt>
  
 
You will find some additional explanations in the <tt>config.php</tt> file above the mentioned lines. If the URL to your store is not being changed, you should not edit these lines.
 
You will find some additional explanations in the <tt>config.php</tt> file above the mentioned lines. If the URL to your store is not being changed, you should not edit these lines.
  
7. Change the current directory to the root X-Cart folder and adjust file permissions in the following way:
+
7. Set proper file permissions on your newly uploaded X-Cart files and directories. See [[X-Cart:After_the_upgrade#Restoring_File_Permissions | Restoring File Permissions]] for more information.
  
<pre>chmod -R 777 templates_c files log catalog skin1
+
8. Upload the database backup file to the MySQL database on the new host using a MySQL terminal. If you have SSH access to your host, you can upload the database using the command-line interface:
</pre>
 
  
==I want to use <u>www.mydomain.com/</u> instead of <u>www.mydomain.com/xcart</u>. How do I move my store?==
+
<pre>mysql -u<user> -p<pass> -h<host> <database> < <backup file></pre>
  
If you want to move your site to root directory, you should move all the files from the directory where X-Cart is installed to root directory. After that you should find <tt>/config.php</tt> and replace the following string:
+
where <user> is the MYSQL database user name, <host> - the MYSQL host name (typically 'localhost'), <pass> - the password to your MYSQL database, and <database> is the database name itself. <backup file> is the name of your database backup file.
  
<pre>
+
If you don't have any terminal access (SSH, telnet or others), check the control panel at your hosting: it may contain PHP MYSQL admin or other MYSQL tools.
$xcart_web_dir ="/xcart";
 
</pre>
 
  
by this:
+
9. Test the newly uploaded X-Cart based store.
 
 
<pre>
 
$xcart_web_dir ="";
 
</pre>
 
  
Do not forget to make backup copies of the original files from root directory which have names similar with the names of files from <tt>/xcart</tt> directory (for example, <tt>index.html</tt>), because they will be replaced when you move your store.
+
10. Move the images from the database to the file system if necessary.
  
Note that if you store product and category images on the file system, you should correct links to images manually after moving your store.
+
==Note on moving stores based on X-Cart 4.5.5 or later==
 +
If moving a live X-Cart 4.5.5 or later store that used to run on PHP 5.3.x to a new hosting, make sure the version of PHP on the new hosting is the same or better than on the hosting you are moving from. Downgrading to PHP 5.2.x is not recommended because under certain conditions it may result in losing the passwords of your existing users.
  
If you want to change the location of php scripts used in customer, administrator and provider zones, you should open the file <tt>top.inc.php</tt> and edit the values of '''DIR_CUSTOMER''', '''DIR_ADMIN''' and '''DIR_PROVIDER''' constants.
+
[[Category:X-Cart developer guide]]
 +
[[Category:X-Cart user manual]]
 +
[[Category:X-Cart developer guide]]
 +
[[Category:X-Cart user manual]]
 +
[[Category:X-Cart developer guide]]
 +
[[Category:X-Cart user manual]]
 +
[[Category:X-Cart developer guide]]
 +
[[Category:X-Cart user manual]]

Latest revision as of 11:35, 15 February 2013

To move your store from one host to another:

1.

X-Cart 4.0or above

If your images are stored on the file system, move them to the database. This can be done under the 'Images location' section of the admin area.

This step is necessary for 4.0.x and earlier versions only. See also: FAQs: How do I know which version of X-Cart I use?

2. Backup the entire directory with your X-Cart based store; that's either the document root directory or one of its subdirectories. It is also recommended to delete the content of the 'templates_c' directory before creating the backup file.

For 4.0.x and earlier versions the 'templates_c' directory is located in the root X-Cart directory. For 4.1.x and later versions - it is located within the '<xcart_dir>/var' directory. See also: FAQs: How do I know which version of X-Cart I use?

3. Backup the database. You can do that using either the 'DB backup/restore' feature (see the corresponding section of the admin interface) or a MySQL terminal utility (like mysqldump or phpMyAdmin).

4. Upload the entire directory with your X-Cart based store to a web-accessible directory on the new server.

5. Edit the config.php file and adjust the settings related to your MySQL database account on the new host:

#
# SQL database details
#

$sql_host ='%SQL_HOST%';
$sql_user ='%SQL_USER%';
$sql_db ='%SQL_DB%';
$sql_password ='%SQL_PASSWORD%';

6. Edit the config.php file and adjust the settings related to the X-Cart HTTP & HTTPS host and web directory where it is to be moved:

$xcart_http_host ="$HTTP_HOST";
$xcart_https_host ="$HTTP_HOST";
$xcart_web_dir ="/xcart";

You should put hostname here only without http:// or https:// prefixes. Also do not put slashes after the hostname. Web dir is the directory in the URL, not the filesystem path. Web dir must start with slash and have no slash at the end, the only exception is when you configure for the root of the site, in which case you should leave it empty.

EXAMPLE 1:

$xcart_http_host ="www.yourhost.com";
$xcart_https_host ="www.securedirectories.com/yourhost.com";
$xcart_web_dir ="/xcart";

- will result in the following URLs:

http://www.yourhost.com/xcart
https://www.securedirectories.com/yourhost.com/xcart

EXAMPLE 2:

$xcart_http_host ="www.yourhost.com";
$xcart_https_host ="www.yourhost.com";
$xcart_web_dir ="";

- will result in the following URLs:

http://www.yourhost.com/
https://www.yourhost.com/

You will find some additional explanations in the config.php file above the mentioned lines. If the URL to your store is not being changed, you should not edit these lines.

7. Set proper file permissions on your newly uploaded X-Cart files and directories. See Restoring File Permissions for more information.

8. Upload the database backup file to the MySQL database on the new host using a MySQL terminal. If you have SSH access to your host, you can upload the database using the command-line interface:

mysql -u<user> -p<pass> -h<host> <database> < <backup file>

where <user> is the MYSQL database user name, <host> - the MYSQL host name (typically 'localhost'), <pass> - the password to your MYSQL database, and <database> is the database name itself. <backup file> is the name of your database backup file.

If you don't have any terminal access (SSH, telnet or others), check the control panel at your hosting: it may contain PHP MYSQL admin or other MYSQL tools.

9. Test the newly uploaded X-Cart based store.

10. Move the images from the database to the file system if necessary.

Note on moving stores based on X-Cart 4.5.5 or later

If moving a live X-Cart 4.5.5 or later store that used to run on PHP 5.3.x to a new hosting, make sure the version of PHP on the new hosting is the same or better than on the hosting you are moving from. Downgrading to PHP 5.2.x is not recommended because under certain conditions it may result in losing the passwords of your existing users.