Magento – Migration from Localhost to Live Server

Migrating from a localhost development version of Magento to a live Production server may be a pain in the ass for starters as we get scared of the too many files and configurations that needs to be changed which is almost an inception.

I’m writing this post to clear the myth and to say that migrating from localhost to live server Magento is as easy as it sounds.

Following are the steps that one should follow to migrate the localhost magento to live server magento.

Step : 1

Login to your PHPMYADMIN of your local server and export the magento database which you need to migrate.

Zip all your localhost files and keep it ready for upload.

Step : 2

Now Upload the zip file to your server and extract the files and make sure the files are placed inside ‘public_html’ folder in your server.

Assuming you’ve created the database through CPanel, now login to your server’s PHPMYADMIN, and import the dump SQL file to the created database.

Step : 3

Go to the ‘public_html’ folder in your server and traverse through the following folder and reach the file “local.xml”

app/etc/local.xml

Below is the database configuration for the whole magento installation.

<connection>
 <host><![CDATA[YOUR_DATABASE_HOST]]></host>
 <username><![CDATA[YOUR_DATABASE_USERNAME]]></username>
 <password><![CDATA[YOUR_DATABASE_PASSWORD]]></password>
 <dbname><![CDATA[YOUR_DATABASE_NAME]]></dbname>
 <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
 <model><![CDATA[mysql4]]></model>
 <type><![CDATA[pdo_mysql]]></type>
 <pdoType><![CDATA[]]></pdoType>
 <active>1</active>
 </connection>

 

Make sure you change the values for “<host>”, “<username>”, “<password>” with your own server credentials.

Save the file and don’t go yet., we’ve two more things to do.

 

Step : 4

Now, go to your live server’s PHPMYADMIN and we’ve to do some changes with the core_config_data values which has the base_url that needs to be changed with the live server url.

Now go to that particular table in your PHPMYADMIN and run the below query

select * from core_config_data where path = 'web/unsecure/base_url';

you’ll see the base url value which is your localhost server url that needs to be changed to your live server domain url like “http://example.com”

We also have to run the below query to change the secure base_url

select * from core_config_data where path = 'web/secure/base_url';

Edit the value to your https domain url like “https://example.com”

That’s it., you’ve successfully migrated your Magento website from Localhost to Live Server without any issues.

P.S : Drop me a comment if you’ve any issues or problems in migration.

Photo Credit : Flickr

If you want to read about WordPress – Migration from Localhost to Live Server

Leave a Reply