Moving Magento From Development Server To Live Server
Posted: 29 August 2010
Magento is a beast. During the last three-or-so months that I've been toying around with it, I'm still yet to come to terms with its complexities. And moving your Magento installation from your development server to a live server is just as complicated as all other things Magento.Having done this quite a few times now, I've recorded this simple procedure to help you move your installation easily. I had quite a lot of difficulty the first time, and this was not helped by the fact that there are a lot of guides varying widely in their procedures. I took a few common elements of all these guides, and put togther this one. I have tested it a couple of times since then, and it has worked flawlessly.

I'm assuming you currently have Magento installed on a local development server. I use XAMPP. Basically, what happens in this procedure is that we first move the files, then the database. We also delete the Magento configuration file. When Magento detects this file is missing, it will trigger the installer the first time you launch it on the new server. That's when you can enter your new database credentials and other settings. Trust me, this is much more convenient than other methods mentioned in the Magento forums. Also worth noting is that the installer will only re-record your new settings; so all your products, themes, categories, sales records, etc. stay intact. Here's the procedure, tested on Magento 1.4.0.0:
Part 1: Move Your Files First
- Browse to your local Magento root and create a .zip file of your entire local Magento install. You could upload the files individually via FTP as well, but given the huge number of directories and files, creating a single .zip and uploading it saves you a lot of time.
- Upload the zip file to your web server, and extract the files in it. This is done via your webhost's control panel (CPanel, DirectAdmin, Plesk, etc.)
- On your web server, go to /var and delete all contents of /var/cache and /var/session directories.
- In your Magento root, replace the /downloader directory with one from a "clean" Magento install. This means:
- Delete the /downloader directory.
- Upload the /downloader directory from a clean Magento install (the official Magento download package) and upload this to your root.
- Delete this file: app/etc/local.xml. The absence of this file will trigger the installer later on. Don't worry, your files and database won't be overwritten.
- Check that your files and directories have the neccessary permissions. To atleast launch the installer, the following have to be set at 777:
- /var/.htaccess
- /var
- /app/etc
Part 2: Transfer The Magento Database
- Take a backup of your Magento database. In PHPMyAdmin, use the Export option and tick the "Disable foreign key checks" checkbox, as foreign key constraints cause problems during database import on the live server.
- Save the .sql file to a location on your PC.
- Import the database dump into the database on your web server.
- Go to the 'core_config_data' table and find the rows 'web/unsecure/base_url' and 'web/secure/base_url'. Replace the values of these rows with the corresponding values of your live store.
You're Good To Go!
Now you should access your site via browser. If you get a blank screen, it's probably due to file permission problems. Check the last step of Part 1.
If you've done everything carefully, you should be greeted with the Magento installation wizard. Once that happens, you can enter you settings again as per your live server. As mentioned above, running the installer again does not modify your site in any way.
Leave a comment if you found this post useful.
30 August 2010
14:34
hi,
nice post
I would also recommend emptying /var/log and /var/report not to “pollute” live server with dev errors
you should also think in cleaning DB (not always may be): sales, customers, logs, newsletter tests, ratings, reviews, sendfriend logs…
check that your DB export has the following line:
SET SQL_MODE=“NO_AUTO_VALUE_ON_ZERO”;
and if you get an error on USING BTREE on DB import: http://www.eliasinteractive.com/blog/magento-database-import-error-using-btree-key-fk_attribute_varchar_entity-entity_id-key-fk_catalo-at-line-9
regards,
Dia
08 September 2010
17:23
I also do the same way. It has helped me to overcome the hectic process of moving my local shop to live shop.
Thanks for Sharing.
Magento Experts
08 September 2010
22:00
That’s why I use zen cart. In my opinion it’s much easier.
09 September 2010
09:53
@Shennan: Well, Magento is very complicated overall, so there's no reason this aspect should be easy...
16 September 2010
04:32
But it shall all be worth it in the end when you become Karl….Skytek King of Magento! Keep up the great work!
22 September 2010
06:43
How would you compare your experience with Magento ease of use to other open source shopping cart systems like Zen Cart?