Moving a Magento shop from one server to another


I had some issues recently when moving a Magento based e-commerce website from one server to another so thought I’d present the best guide I could, taking advice from a variety of different sources that I used. This will preserve your theme and any plug-ins you added. It goes without saying, but don’t delete your existing Magento site until you are 100% sure the new deployment is working correctly.

First we’ll access the development server, take what we need from there and then set up the new site on the live server.

[wp_ad_camp_2]

On the development server (Server we’re moving from):

1) Delete the Magento cache directory, cd to the Magento root directory and run the following.

2) Zip up the Magento site (will need zip).

3) Export the Magento database, either through phpmyadmin or:

4) Download the .zip and .sql files to your local computer ready for upload to the new server.

[wp_ad_camp_2]

On the live server (Server we’re moving to) upload both the .zip and .sql files:

1) Import the Magento database, either through phpmyadmin or:

 

2) There will will be references to your old domain in the database, remove them with these queries

 

Extract the .zip file of the Magento site

If you used  different databases between your development and live server, these need to be changed in /app/etc/local.xml

After these steps, everything should work. But inevitably sometimes there are always issues. If you have carried out the above and don’t have a working website, getting Internal Server Error 500 there are a couple of things you can try.

  1. Download magento-check.php. Put that in your home directory and run it, this will check to see if your server is capable of running Magento (File is in a .zip, make sure you extract it).
  2. Download magento-cleanup.php. Similar to the above, try running this and it will clean up and set the correct permissions on your site (File is in a .zip, make sure you extract it).
  3. Check that your PHP memory limit is at least 256Mb (commonly this is set to something like 32Mb, Magento requires a lot of memory!).
  4. Failing that, look at apache error logs and see what information you can get. Most likely a permissions error. Try deleting the .htaccess. This is not recommended long term, but can be useful for diagnosing the problem. In the Magento root directory run the code below which will rename the .htaccess file, so it won’t be read by Apache and can be restored later.

[wp_ad_camp_2]

Leave a comment

Your email address will not be published. Required fields are marked *