Vous êtes sur la page 1sur 23

How to migrate Magento based website from one server to another ?

June 2, 2011|Magento,Web Development,Web-Tutorials Home Blog Magento How to migrate Magento based website from one server to another ? Please find below the steps involved in the migration of Magento based website from one server to another : 1. Copy all the files from one server to another without changing the folder structure. 2. Create a database and migrate the existing database to the new database. 3. change the database variables in local.xml file which is present in \app\etc folder. 4. Final step involves a few activities in phpmyadmin. Without this youll get error something like this Fatal error: Call to a member function extend() on a non-object in /path/to/public_html/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 142 To avoid this error step 4 invloves : Go to phpmyadmin and type following five commands in SQL text-area : SET FOREIGN_KEY_CHECKS=0; UPDATE `core_store` SET `store_id` = 0 WHERE `code` like admin; UPDATE `core_website` SET `website_id` = 0 WHERE `code` like admin; UPDATE `customer_group` SET `customer_group_id` = 0 WHERE `customer_group_cod e` like NOT LOGGED IN; SET FOREIGN_KEY_CHECKS=1; Check table names in your database. Table names might have nomenclature as x_core_store where x is a variable. In my case it was mage_core_store. So change line 2,3 and 4 accordingly. Hope this helps. Happy Migration !

How to move magento from one server to another


By Robin Pakkarambel August 18, 2011Posted in: CMS, Ecommerce, Featured, Magento

Hi friends, If you are a Magento developer sometimes you need to move the Magento ecommerce shop from one host server domain to new host server domain or from one directory location to another directory location. Migrating Magento to a new server is a simple task once you know how to do it. This How to move Magento from one server to another post will outline the steps involved to successfully migrate a Magento website.

METHOD 1

Follow the below given instructions, 1) Back up the files in the test server. Go to your test site admin backend and refresh Cache by System > Cache Management. Then download and save the whole magento shop root directory via File manager or FTP tools. 2) Export the magento Database. Enter your server control panel phpmyadmin database area and EXPORT your magento shop database in to name.sql.zip format. 3) Move magento files to the new server. Upload the root directory ( all the files) of your test magento shop backup taken on the step 1 in to the new server domain folder.

4) Import the database to the new server. Go to your new host account phpmyadmin and create a new database, database user and database user password. Then open the database sql file saved on step 2 with a text editor and edit the database name mention in to the new database name, save it. Then import the name.sql.zip database backup saved on the step 2 in to this new database. 5) Update the database details file. Next step is to edit the database details file. To do this go to magento live site folder, find out app/etc/local.xml file and enter the latest Database details which is created on the step 4. 6) Modify the base URL database table. Next is to replace old server domain name with new domain name. For this go to your new server phpmyadmin magento database and modify core_config_data table as shown below. web/unsecure/base_url web/secure/base_url > http://www.newdomain.com/ > http://www.newdomain.com/

7) Refresh cache and Reindex Data. The final step is to clear the cache. Go to your sites admin panel ( Login with the test site username and password ) System > Cache management > Select all & disable cache management. Then navigate through System>Index Management. Select fields in Status REINDEX REQUIRED, then choose Reindex Data from drop down and click Submit or delete all the files in var/session and /var/cache folders of new site. Take a look to your new magento ecommerce store frontend.

METHOD 2

Here is an another method ( one problem is on this method both magento setups must be the same version ), 1) Go to your test site backend and refresh cache by system > cache management. Then take a backup of test site phpmyadmin database by exporting database in to dbname.sql.zip format ( or any suitable format). 2) Next is to take a backup of below folders on the test site to your system

(a) Contents inside frontend folder

(app\design\frontend)

(b) Contents inside frontend folder (skin\frontend) (c) Catalog & other required folders (media\catalog)

3) Install a new magento store in to the new server. 4) Go to the new server phpmyadmin database and delete all the tables. 5) Unzip backup database on the first step dbname.sql.zip and import dbname.sql file to the new database. 6) Copy below folders to their respective new magento server directory (a) Contents inside frontend (app) folder to app\design\frontend. (b) Contents inside frontend (skin) folder to skin\frontend. (c) Catalog & other required folders to media\catalog, xx\ 7) Edit base URL mentioning table ( core_config_data table ) on the new magento. web/unsecure/base_url web/secure/base_url > http://www.newsite.com/ > http://www.newsite.com/

8) Go to your sites admin panel System > Cache management > Select all & disable cache management. And also index data by go to System>Index Management. Select fields in Status REINDEX REQUIRED, then choose Reindex Data from drop down and click Submit. Check your new magento store.

Moving Magento To Another Server


Last modified by Rico Neitzel on Thu, June 24, 2010 16:29 Source|Old Revisions Table of Contents

Moving Magento To Another Server o Alternative Languages o Overview o Old Server MySQL Dump Media Directory Theme Files Config File o New Server Copy Files Install Magento Import Database PEAR Downloader Restore Media & Theme Restore Config File Have A Beer o Alternative Method

The following article will outline the steps and commands involved to successfully transfer Magento from one server to another. This article assumes you have a basic understanding of SSH, and that you have SSH access on both servers.

Alternative Languages
There is brief german Version of Moving Magento to another Server. It is filed under serverumzug.

Overview
Here is an overview of the steps well take to do this:
1. 2. 3. 4. 5. 6. Make a MySQL dump file of the database Archive the media and theme directories Copy the files to the other server Install a clean version of Magento Import the dump file to a blank database Move our copied data to the correct places

Old Server
The first thing youll want to do is login to the server where Magento currently resides. You will need to go to the directory where Magento is installed. For the sake of this article, Im going to assume your directory structure on both servers looks like this:
/home/username/public_html/

The public_html directory is considered the root directory for your domain, so if we had a file called test.html in there, it would be accessible like so:
http://www.example.com/test.html

With that in mind, we need to go to the directory where Magento is installed. In our case, its installed in the root of the domain, so once we are logged in we will run the following:
1. cd public_html

By default, when you login to SSH it will place you in the very root directory that you have access rights to, which is typically one directory above the public_html directory. We will start by making a folder called backup, so we can place all of the files we want to transfer over to the new server in:
1. mkdir backup MySQL Dump

Now we need to create a MySQL dump file of our database:


1. mysqldump -h DBHOST -u DBUSER -pDBPASS DBNAME > data.sql

You will need to replace the values with the correct information:

DBHOST - Database host name, usually just localhost DBUSER - Database user with access rights to the database DBPASS - The password for the database user DBNAME - The name of the database that Magento is using

NOTE: If your password contains special characters or punctuation marksfor example, if your password was Ure+Ha_A?r2anpyoull want to use this command instead:
1. mysqldump -h DBHOST -u DBUSER -p DBNAME > data.sql

After you run this command, it will ask you to enter the database password, and you can safely enter it.

Depending on the size of your database, this can take a couple seconds to a couple minutes. If no errors are reported and youre left with a new command line, then the dump file was created successfully. We can safely move this to the backup directory we created earlier:
1. mv data.sql backup/ Media Directory

Now lets compress the contents of the media directory:


1. tar -cvf media.tar media/*

And move it over to our backup directory:


1. mv media.tar backup/ Theme Files

Next, were going to copy the theme directory from both the app and skin directories. For the sake of this article, Im going to assume you have not created a new interface, and that were using the default interface instead. Well start with the theme in the app directory:
1. cd app/design/frontend/default/

If you were wondering what I meant by interface, its the last directory in the previous command. Most people do not create a new interface, but if you did, youll want to change the last directory name with the interface name youre using. The directory were in now is where all the themes for the default interface reside. There should already be a folder in here called default. I hope youre not modifying the files in this directory to customize the theme for your website. If you have, youll want to rename this directory to something more appropriate so it does not get overwritten when you upgrade Magento. For the sake of this article, were going to assume that our theme is called mytheme, so lets compress it:
1. tar -cvf app.tar mytheme/

We need to move this tar file to our backup directory now:

1. mv app.tar ../../../../backup/

We need to do the same thing for the theme in our skin directory, so lets change in to that directory:
1. cd ../../../../skin/frontend/default/

This works the same way as the interface and theme in the app directory. If youre using another interface, change the last directory name out with your interface name. Just like the app directory, we should have a directory in here called mytheme, so lets compress that as well:
1. tar -cvf skin.tar mytheme/

And move it to our backup directory:


1. mv skin.tar ../../../backup/

Now lets head back to the main directory:


1. cd ../../../ Config File

Only thing left is our config file, so lets copy that over as well:
1. cp app/etc/local.xml backup/

Alright, so we have all of the data we need!

NOTE: If you want to copy your .htaccess or php.ini (assuming you have one) in to the backup directory, now is the time to do it. You dont need the .htaccess or php.ini file unless youve made changes to them. However, if you do want to move them over, run the following command:
1. cp .htaccess php.ini backup/

Our backup directory will now have the following files in it:

local.xml app.tar data.sql media.tar skin.tar

New Server
Were ready to set Magento up on the other server now, so SSH in to your account and go to your public_html directory:
1. cd public_html

We now want to grab all of the files from the other server, but lets create a backup directory here so we have somewhere to move the files:
1. mkdir backup

And lets go in to that directory:


1. cd backup/ Copy Files

Time to grab the files from the remote server:


1. 2. 3. 4. 5. wget wget wget wget wget http://www.example.com/backup/local.xml http://www.example.com/backup/app.tar http://www.example.com/backup/data.sql http://www.example.com/backup/media.tar http://www.example.com/backup/skin.tar

Youll want to replace the above URLs with the IP address or domain name from the old server. Usually whatever domain you had setup on the old server will be the same one you have on the one.

NOTE: If youve already updated the DNS nameservers for your domain and its pointing to the server were moving the files over to, you cannot use the domain name. Use the IP address instead. If you havent updated the nameservers for your domain yet, then you can use that.

Now we have all of our files over here. So lets do a clean install of Magento. We need to go back to the public_html directory, because right now were still in the backup directory:
1. cd ..

Install Magento

Ok, time to install Magento:


1. wget http://www.magentocommerce.com/downloads/assets/1.1.6/magento1.1.6.tar.gz 2. tar -zxvf magento-1.1.6.tar.gz 3. mv magento/* magento/.htaccess . 4. mv php.ini.sample php.ini 5. chmod o+w var var/.htaccess app/etc 6. chmod -R o+w medias Import Database

If you havent setup a blank database on this server yet, do so now. Were going to import the data from the dump file in to this database:
1. mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < backup/data.sql

Replace the values like you did when we created a dump file.
PEAR Downloader

Now we want to initialize the PEAR registry and let Magento update anything in our database that needs to be updated:
1. ./pear mage-setup . 2. ./pear install magento-core/Mage_All_Latest

Lastly, a little bit of cleanup:


1. rm -rf downloader/pearlib/cache/* downloader/pearlib/download/* 2. rm -rf magento/ magento-1.1.6.tar.gz 3. rm -rf index.php.sample .htaccess.sample STATUS.txt Restore Media & Theme

Almost finished! We just have to move the media directory back in place and the themes:
1. cp backup/app.tar app/design/frontend/default/ 2. cp backup/skin.tar skin/frontend/default/ 3. cp backup/media.tar media/

And we need to extract the data:

1. cd app/design/frontend/default/ 2. tar -xvf app.tar 3. rm -rf app.tar 4. cd ../../../../skin/frontend/default/ 5. tar -xvf skin.tar 6. rm -rf skin.tar 7. cd ../../../media/ 8. tar -xvf media.tar 9. rm -rf media.tar 10. cd .. Restore Config File

Ok, so everything should be in its place. The only thing left to do is move the local.xml file where it belongs:
1. mv backup/local.xml app/etc/

If your database details have changed from what you had on the old server, youll need to edit the local.xml file and update the appropriate information. It should be pretty clear what you need to update in there.
Have A Beer

Thats it! Open up your browser and your site should be working. If it is, you can delete the backup directory on the new server:
1. rm -rf backup/

The data on the older server is safe to delete as well.

Alternative Method
The above method starts you out with a fresh, clean installation of the latest version of Magento. If you experience problems using this method, theres another way to copy the data. Follow the instructions above for creating a MySQL dump file, and leave that in the directory where Magento is installed. Youre then going to archive the entire public_html directory, so youll want to be one directory above the directory where Magento is installed:
1. tar -cvf backup.tar public_html/

You will then need to use wget like we did before to transfer this file from the old server to the new one. Extract the data from the backup archive we created:
1. tar -xvf backup.tar

And move it out of its directory:


1. mv public_html/* public_html/.htaccess .

You can remove the extracted public_html directory now. Do not confuse this with the public_html directory for your site, this is only the name of the directory that was in our backup file!
1. rm -rf public_html/

Now you need to create a blank database and import the MySQL dump file to it. The instructions are listed in the previous method. Lastly, edit the local.xml file and update the database variables if theyve changed. Youll also want to delete your cache directory out:
1. rm -rf var/cache/* var/session/* var/report/*

Thats it, youre all done!

Moving Magento To Another Server


Last modified by alson on Thu, April 26, 2012 08:34 Source|Old Revisions | Back To Group Table of Contents

Moving Magento To Another Server o Overview o Old Server MySQL Dump Media Directory Theme Files Config File o New Server Copy Files Install Magento Import Database PEAR Downloader

Restore Media & Theme Restore Config File Magento Connect Extensions & configurations Update 1 Have A Beer (STZBR!) Alternative Method

The following article will outline the steps and commands involved to successfully transfer Magento from one server to another. This article assumes you have a basic understanding of SSH, and that you have SSH access on both servers.

Overview
Here is an overview of the steps well take to do this:
1. 2. 3. 4. 5. 6. Make a MySQL dump file of the database Archive the media and theme directories Copy the files to the other server Install a clean version of Magento Import the dump file to a blank database Move our copied data to the correct places

TO DO:
1. Include commands for saving app/code/local/ folder

Old Server
The first thing youll want to do is login to the server where Magento currently resides. You will need to go to the directory where Magento is installed. For the sake of this article, Im going to assume your directory structure on both servers looks like this:
/home/username/public_html/

The public_html directory is considered the root directory for your domain, so if we had a file called test.html in there, it would be accessible like so:
http://www.example.com/test.html

With that in mind, we need to go to the directory where Magento is installed. In our case, its installed in the root of the domain, so once we are logged in we will run the following:
1. cd public_html

By default, when you login to SSH it will place you in the very root directory that you have access rights to, which is typically one directory above the public_html directory. We will start by making a folder called backup, so we can place all of the files we want to transfer over to the new server in:
1. mkdir backup MySQL Dump

Now we need to create a MySQL dump file of our database: You can create a dump file and import it into your new database using one line in your terminal. You need to have remote access the the old server.
1. mysqldump -h oldhost -u oldusername -poldpassword --singletransaction olddbname | mysql -h newhost -u newusername pnewpassword newdbname

Otherwise, you may do the following


1. mysqldump -h DBHOST -u DBUSER -pDBPASS --single-transaction DBNAME > data.sql

You will need to replace the values with the correct information:

DBHOST - Database host name, usually just localhost DBUSER - Database user with access rights to the database DBPASS - The password for the database user DBNAME - The name of the database that Magento is using

NOTE: If youre running MySQL 4.x, you should include the following option:
--default-character-set=utf8

NOTE: If your password contains special characters or punctuation marksfor example, if your password was U!re+Ha_A?r2anpyoull want to use this command instead:
1. mysqldump -h DBHOST -u DBUSER -p --single-transaction DBNAME > data.sql

After you run this command, it will ask you to enter the database password, and you can safely enter it.

Depending on the size of your database, this can take a couple seconds to a couple minutes. If no errors are reported and youre left with a new command line, then the dump file was created successfully. We can safely move this to the backup directory we created earlier:
1. mv data.sql backup/ Media Directory

Now lets compress the contents of the media directory:


1. tar -cvf media.tar media/*

And move it over to our backup directory:


1. mv media.tar backup/ Theme Files

Next, were going to copy the theme directory from both the app and skin directories. For the sake of this article, Im going to assume you have not created a new interface, and that were using the default interface instead. Well start with the theme in the app directory:
1. cd app/design/frontend/default/

If you were wondering what I meant by interface, its the last directory in the previous command. Most people do not create a new interface, but if you did, youll want to change the last directory name with the interface name youre using. The directory were in now is where all the themes for the default interface reside. There should already be a folder in here called default. I hope youre not modifying the files in this directory to customize the theme for your website. If you have, youll want to rename this directory to something more appropriate so it does not get overwritten when you upgrade Magento. For the sake of this article, were going to assume that our theme is called mytheme, so lets compress it:
1. tar -cvf app.tar mytheme/

We need to move this tar file to our backup directory now:


1. mv app.tar ../../../../backup/

We need to do the same thing for the theme in our skin directory, so lets change in to that directory:
1. cd ../../../../skin/frontend/default/

This works the same way as the interface and theme in the app directory. If youre using another interface, change the last directory name out with your interface name. Just like the app directory, we should have a directory in here called mytheme, so lets compress that as well:
1. tar -cvf skin.tar mytheme/

And move it to our backup directory:


1. mv skin.tar ../../../backup/

Now lets head back to the main directory:


1. cd ../../../ Config File

Only thing left is our config file. This file contains the encryption key, the user name and password to connect to the database. If the connection parameters are different between your old and new servers, then you need to edit this file to reflect the changes. The editing is straight forward as the password for the database connection is not encrypted. Now, lets copy that over as well:
1. cp app/etc/local.xml backup/

Important note about caching! If you are using apc caching (<cache><backend>apc</backend> in local.xml) and are creating a copy of the installation on the same server, you MUST change the <cache><prefix> setting to a new value. The reason for this is that if apc cache is used, magento will save all cache entries in the apc itself instead of /var/cache directory. And the apc cache storage is the same for the whole server, it knows nothing about installations, and <prefix> setting is the only thing that can tell it which website each cache entry belongs to. If you have two sites running with the same prefix, some very strange and hard-to-find errors may occur like data from one shop appearing in another shops menus, spontaneous redirects to the other shops url in back-end, changing of settings in backend affecting the other installation etc, etc. Alright, so we have all of the data we need! If you omit this file in the new server, you will have to go through the setting up process the first time you browse your site in the new server. Here, Magento will make a new encryption key which will cause problems with the credit card information and passwords in the database.

NOTE: If you want to copy your .htaccess or php.ini (assuming you have one) in to the backup directory, now is the time to do it. You dont need the .htaccess or php.ini file unless youve made changes to them. However, if you do want to move them over, run the following command:
1. cp .htaccess php.ini backup/

Our backup directory will now have the following files in it:

local.xml app.tar data.sql media.tar skin.tar

New Server

NOTE: Before continuing to move your site make sure that your server has all the necessary software components installed. Do the Magento Server Compatibility Check as described here: http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-iscompatible-with-magento. A couple of tips: 1) PDO for mysql needs to be installed (ubuntu: apt-get install php5-mysql) 2) The curl extension for PHP5 needs to be installed. (ubuntu: apt-get install php5-curl). Without this when attempting to access the admin login you will see a blank page on the server you have transferred the Magento install to. IMPORTANT NOTE FOR MAMP USERS: You must select PHP 5.2 in the PHP preferences!

Were ready to set Magento up on the other server now, so SSH in to your account and go to your public_html directory:
1. cd public_html

We now want to grab all of the files from the other server, but lets create a backup directory here so we have somewhere to move the files:

1. mkdir backup

And lets go in to that directory:


1. cd backup/ Copy Files

Time to grab the files from the remote server:


1. 2. 3. 4. 5. wget wget wget wget wget http://www.example.com/backup/local.xml http://www.example.com/backup/app.tar http://www.example.com/backup/data.sql http://www.example.com/backup/media.tar http://www.example.com/backup/skin.tar

Youll want to replace the above URLs with the IP address or domain name from the old server. Usually whatever domain you had setup on the old server will be the same one you have on the one.

NOTE: If youve already updated the DNS nameservers for your domain and its pointing to the server were moving the files over to, you cannot use the domain name. Use the IP address instead. If you havent updated the nameservers for your domain yet, then you can use that.

IMPORTANT SECURITY NOTE: Using the method above you are putting all of your data (including credit card data if you are storing it), your website files and the config file containing your database password on the public internet for anyone to download. If you must use this method, you may want to use something other than /backup as your path, and you will certainly want to delete the files immediately when you have copied them. Consider putting the files in a private folder and copying via SFTP instead. Alternatively you can do a secure copy (SCP) as below:
1. scp -r username@example.com:/home/username/public_html/backup .

Sure this copy will be really secure only if /backup folder is out of /public_html as below:
1. scp -r username@example.com:/home/username/backup .

Now we have all of our files over here. So lets do a clean install of Magento. We need to go back to the public_html directory, because right now were still in the backup directory:
1. cd .. Install Magento

Ok, time to install Magento:


1. wget http://www.magentocommerce.com/downloads/assets/1.6.0.0/magento1.6.0.0.tar.gz 2. tar -zxvf magento-1.6.0.0.tar.gz 3. mv magento/* magento/.htaccess . 4. mv php.ini.sample php.ini 5. chmod o+w var var/.htaccess app/etc 6. chmod -R o+w media Import Database

If you havent setup a blank database on this server yet, do so now. Were going to import the data from the dump file in to this database:
1. mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < backup/data.sql

Replace the values like you did when we created a dump file.
PEAR Downloader

Now we want to initialize the PEAR registry and let Magento update anything in our database that needs to be updated:
1. chmod 550 ./mage 2. ./mage mage-setup . 3. ./mage install community Mage_All_Latest

Lastly, a little bit of cleanup:


1. rm -rf downloader/pearlib/cache/* downloader/pearlib/download/* 2. rm -rf magento/ magento-1.6.0.0.tar.gz 3. rm -rf index.php.sample .htaccess.sample STATUS.txt Restore Media & Theme

Almost finished! We just have to move the media directory back in place and the themes:

1. cp backup/app.tar app/design/frontend/default/ 2. cp backup/skin.tar skin/frontend/default/ 3. cp backup/media.tar .

And we need to extract the data:


1. cd app/design/frontend/default/ 2. tar -xvf app.tar 3. rm -rf app.tar 4. cd ../../../../skin/frontend/default/ 5. tar -xvf skin.tar 6. rm -rf skin.tar 7. cd ../../../ 8. tar -xvf media.tar 9. rm -rf media.tar 10. cd .. Restore Config File

If your database details have changed from what you had on the old server, youll need to edit the local.xml file and update the appropriate information. It should be pretty clear what you need to update in there, all the fields are plain and not encrypted. So the last thing left to do is to move the local.xml file where it belongs:
1. mv backup/local.xml app/etc/ Magento Connect Extensions & configurations

To migrate your extensions you need to copy these folders:


app/code/community app/code/local app/etc/modules js

Update 1

You need to edit a few things in the database if your changing domain names or if youre using a test server thats just an IP address. Using PHPMyAdmin, Navicat or something similar, connect to the database. Table core_config_data has rows that need to be changed and updated with the new url. For a single store installation you need to just update:
path: web/unsecure/base_url web/secure/base_url value: http://[you_domain_here]/ https://[your_secure_domain_here]/

with multiple stores you need also change:


path: web/unsecure/base_url web/secure/base_url web/unsecure/base_link_url web/unsecure/base_skin_url web/unsecure/base_media_url web/unsecure/base_js_url web/secure/base_link_url web/secure/base_skin_url web/secure/base_media_url web/secure/base_js_url value: http://[you_domain_here]/ https://[your_secure_domain_here]/ http://[your_domain_here]/ http://[your_domain_here]/skin/ http://[your_domain_here]/media/ http://[your_domain_here]/js/ https://[your_secure_domain_here]/ https://[your_secure_domain_here]/skin/ https://[your_secure_domain_here]/media/ https://[your_secure_domain_here]/js/

~Fastmover evisboy on forums provide example of code for MySQL:


1. UPDATE core_config_data SET value="unsecure.domain.com" WHERE path=web/unsecure/host; Have A Beer (STZBR!)

Thats it! Open up your browser and your site should be working. If it is, you can delete the backup directory on the new server:
1. rm -rf backup/

The data on the older server is safe to delete as well.

Alternative Method
The above method starts you out with a fresh, clean installation of the latest version of Magento. If you experience problems using this method, theres another way to copy the data. Follow the instructions above for creating a MySQL dump file, and leave that in the directory where Magento is installed. Make sure you Refresh or Disable the cache before exporting the database. You can also do an Export via phpMyAdmin. Youre then going to archive the entire public_html directory, so youll want to be one directory above the directory where Magento is installed:
1. tar -cvf backup.tar public_html/

You will then need to use wget like we did before to transfer this file from the old server to the new one. Extract the data from the backup archive we created:

1. tar -xvf backup.tar

And move it out of its directory:


1. mv public_html/* public_html/.htaccess .

You can remove the extracted public_html directory now. Do not confuse this with the public_html directory for your site, this is only the name of the directory that was in our backup file!
1. rm -rf public_html/

Now you need to create a blank database and import the MySQL dump file to it. The instructions are listed in the previous method. Open the new database with phpMyAdmin (or however you prefer), go to the [mage]core_config_data table, and edit the web/unsecure/base_url and web/secure/base_url (config_ids 2 and 3) rows to reflect the new URL of the new server. (Note: some seem to avoid this step by changing the paths to { {base_url} } in the Admin section [SystemConfigurationGeneralWebSecure and Unsecure] before attempting to move the site, and then changing it in the Admin after the move.) (Another quick way to deal with the URL changes is to load the SQL dump into Editplus or something similar and search and replace the URLs before importing) Edit the local.xml (app/etc/local.xml) file and update the database variables if theyve changed (but keep the same security/encryption key). Lastly, in order to make magento connect to work correctly edit the pear.ini (downloader/pearlib/pear.ini) and update al the paths that you see in this file. Otherwise magentoconnect will try to upgrade your old site when you use it. (the files downloader/pearlib/pear downloader/pearlib/peardev downloader/pearlib/pecl may also need the paths updating if you have changed the path) (Note: Updating this file -pear.ini- is a tedious job, because when you change the paths, you also need the update the field before it which starts with s:. You need to type in the length of characters of the path field that you have updated.) A simple helper script to generate a new the pear.ini file: drop your old pear.ini in the same directory as the PHP script, adjust the paths in the script, open it in a browser and paste the contents into your new pear.ini.
1. <?php 2. header('Content-type: text/plain'); 3. $contents = explode("n", file_get_contents('pear.ini'));

4. $data = unserialize($contents[1]); 5. 6. foreach($data as $key => $value) { 7. if(is_string($value)) { 8. $data[$key] = str_replace('/old/path', '/new/path', $value); 9. } 10. } 11. 12. echo $contents[0] . "n"; 13. echo serialize($data); 14. ?>

Note: The code above splits the ini file into lines by detecting the n character - depending on the operating system you are running on the correct new line character to split your file may vary. Make sure there is nothing in the cache directory (var/cache and var/session):
1. rm -rf var/*

Finally make sure the permissions are still correct on the new server:
1. chmod o+w var var/.htaccess app/etc 2. chmod -R o+w media

If you find any errors, make sure folder permissions are set to 755 and file permissions to 644. If your administration submenu pulldowns dont work, make sure /js/index.php is 644. Thats it, youre all done!