Moving Magento installation from one server to another

In my case i had to configure an “installed & working” copy of Magento in my development server (localhost) for development purpose. As a new comer in Magento, i had to do some r&d in order to make it working in my localhost.

(Although this is not mandatory, first of all i created a virtual host named mymagento.local for Magento installation on my localhost. Click here to know how to create a new virtual host in Xampp in Ubunut, Linux or Windows.

As a simple note, if one does not create virtual host one is supposed to access Magento in web browser like http://localhost/mymagento instead of http://mymagento.local as in my case.)

After following this thread i performed the following tasks:

1) Deleted the content of the folder /var

2) Changed the values of the file /app/etc/local.xml. In this file you can find your connection string data (database user, host and name). For example, to change Database vars you will find a section in this file which contains XML like this, which is supposed to contain Database information:

<resources>
    <db>
        <table_prefix><![CDATA[mage_]]></table_prefix>
    </db>
    <default_setup>
        <connection>
            <host><![CDATA[localhost]]></host>
            <username><![CDATA[mysqluser]]></username>
            <password><![CDATA[mysqlpass]]></password>
            <dbname><![CDATA[mysqldbname]]></dbname>
            <active>1</active>
        </connection>
    </default_setup>
</resources>

3) Once i had finised importing the magento database through phpMyAdmin, i needed to make some changes to web url of the Magento installation. In other words you run this query to update the urls:

SELECT * FROM core_config_data WHERE path = 'web/unsecure/base_url' OR path = 'web/secure/base_url';

If you have got table_prefix setup as non-empty you will have to modify table name accordingly. In my case i had got table_prefix setup as “mage_” so my sql query went like this:

SELECT * FROM mage_core_config_data WHERE path = 'web/unsecure/base_url' OR path = 'web/secure/base_url';

Now, i needed to edit both listed “values” to http://mymagento.local/ as i was on local. (On a remote live server value of “web/secure/base_url” is supposed to start with https://)

I went to http://mymagento.local in my Chrome Browser and everything worked fine.

Leave a Reply