So you created an eCommerce website on localhost but now want to transfer it along with the entire database to your server? If you would have hired eCommerce development services providers, then they can help you with all including development, deployment, migration, management, and more. But if you have created a site by yourself then you need to be careful while transferring your site from one to another.
Migration of a Magento site from localhost to your live server isn’t a complicated process but there are some tiny details that you should pay attention to. Therefore, here in this article, we have provided you with a step-by-step guide that can guide you through the entire migration process.
Steps to Move Magento Store from Localhost to a Live Server
Before you start the process of migrating your Magento store from localhost to liver server make sure that you are equipped with everything or taking help from an experienced ecommerce development service provider in order to execute the process of migration
- A Magento hosting plan
- A domain name
- phpMyAdmin account
- MySQL database
Now, if you have all the above-mentioned things, then let’s get started.
Step 1: Export the Database from the Local server
- First of all, you have to log into the phpMyAdmin account that you have previously created on your computer based on your local server. Here I assume that you will also be using one of the localhost software such as WAMP or XAMPP.
- After that go to the store and open the database.
- There you will get to see a menu on the top, click on the ‘export’ option, and then on the ‘go’ button. This will enable you to download all the files that are stored in the database in the ‘.sql’ extension version. But do not forget to save them in a zip form.
Step 2: Create Magento Files in Zip Format
Now, the time has come when you have to transform all your Magento files into zip format. Because later you will need to upload them all on a live server.
- Now, let us assume that you use XAMPP as your localhost software, open your ‘htdocs’ folder, and then open the Magento folder. There you can compress all the files into a zip format.
- In case you are using WAMP, then you have to check out your ‘www’ folder.
Step 3: Upload the Magento Files from Localhost to the Live Server
Here in this step, we are going to use the control panel to upload all your Magento database to your domain.
- First, you have to log in to the cPanel of your live server to log in to the phpMyAdmin account. There you have to create a new database.
- But before you click the ‘new’ button to create the new database, you have to make sure that you have got all the details right such as the username and the password.
Step 4: Import the Database
- Now that you have built a new database for yourself, it’s time to import the database that you previously downloaded from your localhost server to your computer in the zip form.
- First of all, you have to select the database you have built. Then again, go to the menu at the top of the screen and find the ‘import link’ button.
- After you select the import link, you have to go to the files section which will give you the option to ‘choose file’ to import to the database.
- Select all the files that you wish to import from your computer. Remember that the extended version of those files must be ‘.sql’.
- When everything is good to go, select the ‘go’ button. It might take some time to import the files from your computer into the database.
Step 5: Upload the Magento Files
If the need arises, you can create a new subfolder in your domain. Normal directories work just fine but if you need a subfolder, this will be the time to create it.
- Upload all those magneto zip files in the newly created database.
- After you have uploaded all the zip files, you can start extracting the database files from them.
See? You have almost migrated your Magento site from localhost to your liver server.
Step 6: Modify the php.xml File to Retrieve the Magento System to New Database
If you have completed the Magento file uploading and extraction task then you can move on to this next step which requires you to use the directory to make some necessary changes in the php.xml file. Here’s what you have to do:
- To locate the file, you have to open app/etc/php.xml. There you can choose the php.xml file.
- You have to take the new database that you have created in your domain as a reference to make changes in your php.xml file. The information might consist of your username, password, and the name of the files you created when you were importing the database.
- Then you have to find a file that contains such appropriate information. Once you find it, you will realize that you need to change its connection tag too.
Step 7: Find the New Domain for Magento System
- In the last step, you have made some changes with reference to your database, so here’s a reminder to ensure that you must save your changes by clicking on the save button displayed on the top right corner of your screen.
- Now, if you decide to make these changes after downloading the file then afterward you have to upload the changed file from the directory.
- In case you choose to download and make the changes in the file, then you will have to upload it from the directory.
- Next, open your Magento database to search for ‘Table Core_Config_Data’.
- Replace the local URL with the domain name in ‘web/unsecure/base_url’ and ‘web/secure/base_url’.
Step 8: Clear the Cached Data
You need the data for your Magento website that is recently connected with your live server. You can make that space for it by clearing the cached data from localhost. You need to follow the steps mentioned below to clear the cached data.
- Open ‘/var/cache
- To delete all the data stored in it, you have to select all the files and then click on the red button with delete written on it.
- Now, you have successfully migrated your Magento store from localhost to your live server.
Step 9: Use the Store – Successfully Move Magento from Localhost to Live Server
After completing all the steps we discussed above, you would have uploaded your Magento site to your server. To check if the task is successful or not, do as follows:
Open your browser and put in the domain name of your Magento website to search for it.
If your Magento eCommerce store is successfully uploaded to your server then you will be able to see the front end of your website on the screen.
Business owners choose to create an eCommerce website on localhost because it is easy and cost-effective. It allows you to work privately on your site but you also need to migrate your website to a live server later. Creating a Magento website using localhost also enables you to securely test the changes you make to modify your website. And after all the modifications are completed, you have to transfer your site from localhost to the live server.
Here, in this article, we discussed what you would need and how you can migrate your Magento store from localhost to live server. I hope that this would help you accomplish the task easily.