How to migrate site from local development machine to live site manually
Most web developers like to develop websites on local development machines and on completion migrate it to a live site. In this post, we will see How to migrate site from local development machine to live site manually. In this tutorial, the local site is build using Drupal CMS (PHP, MySql) on Windows using XAMPP suite.
Check out these previous post how to install XAMPP on Windows for development purposes:
How to migrate site from local development machine to live site?
To run a live site, we need to have a host purchased from web hosting companies and a domain name. I will not be covering the details here.
A) Prerequisites:
A) Prerequisites:
Before you migrate website from local development machine to live server make sure the following requirements are met.
1) Web Hosting is purchased
2) Domain is purchased
3) We are able to access the Control Panel on the web host (LInux Host and CPanel in this case)
4) FTP account is created
5) Download and install free FTP program such as FileZilla
(See here How to configure FTP on FileZilla client program? )
2) Domain is purchased
3) We are able to access the Control Panel on the web host (LInux Host and CPanel in this case)
4) FTP account is created
5) Download and install free FTP program such as FileZilla
(See here How to configure FTP on FileZilla client program? )
B) Preparation on the live server (host):
B.1) Create a new database for the live website on the server
1) Access www.sitename.com/cpanel
2) Click on "MySql databases"
3) Create a new database
4) Create a new user for the database and set password.
Remember to note the database name, user name and the password.
5) Add / Assign the user created to the database
6) Grant "full privilege" to the user
The database and user is created. We are now ready to import the database from the local machine.
C) Export database from local machine:
2) Click on "MySql databases"
3) Create a new database
4) Create a new user for the database and set password.
Remember to note the database name, user name and the password.
5) Add / Assign the user created to the database
6) Grant "full privilege" to the user
The database and user is created. We are now ready to import the database from the local machine.
C) Export database from local machine:
The database exported from this step will be imported to the live website.
1) Access http://localhost/phpmyadmin and login
2) Click on the database to be exported
3) In phpMyAdmin, click on the "Export" tab
4) Export the database.
A .sql file will be downloaded on the local computer
D) Import the local database to live site:
1) Access www.sitename.com/cpanel
2) Click on 'phpMyAdmin"
3) Click on the database created in step "B"
4) Click on the "Import" tab
5) Browse for the .sql database file exported in step "C"
6) Wait for the process to complete
E) Upload the website files to the live server
1) Open FTP program like FileZilla (See here How to configure FTP on FileZilla client program? )
2) Connect to the live site via FileZilla
3) Upload the website files to the root of the live server.
If the site is being uploaded to a subdomain or subfolder, upload inside the respective folders.
4) Wait till all the files are uploaded.
F) Edit database details in the settings file
Usually, the name of the database, the database user name, and the password used to conenct to the database on the live site will be different from the details used on local development environment. So, depending on your kind of setup, the details need to be edited in the settings file. In this case, the website is built using Drupal, and thus, we'd be editing the "Settings.php" file.
1) Access www.sitename.com/cpanel
2) Click on File Manager
3) Navigate to “Public_html\sites\default”
4) Open "settings.php" to edit
5) Scroll down and edit the following lines in "settings.php"
6) Save the "settings.php"
You can also edit the "settings.php" before uploading the site files to the live server in step "E" .
G) Testing your website
Open the website in a browser by it's url : www.yoursite.com and see if the site opens.
If the above process was followed correctly, and the settings files are updated with the database and user details created, the site should work correctly.
2) Click on the database to be exported
3) In phpMyAdmin, click on the "Export" tab
4) Export the database.
A .sql file will be downloaded on the local computer
D) Import the local database to live site:
1) Access www.sitename.com/cpanel
2) Click on 'phpMyAdmin"
3) Click on the database created in step "B"
4) Click on the "Import" tab
5) Browse for the .sql database file exported in step "C"
6) Wait for the process to complete
E) Upload the website files to the live server
1) Open FTP program like FileZilla (See here How to configure FTP on FileZilla client program? )
2) Connect to the live site via FileZilla
3) Upload the website files to the root of the live server.
If the site is being uploaded to a subdomain or subfolder, upload inside the respective folders.
4) Wait till all the files are uploaded.
F) Edit database details in the settings file
Usually, the name of the database, the database user name, and the password used to conenct to the database on the live site will be different from the details used on local development environment. So, depending on your kind of setup, the details need to be edited in the settings file. In this case, the website is built using Drupal, and thus, we'd be editing the "Settings.php" file.
1) Access www.sitename.com/cpanel
2) Click on File Manager
3) Navigate to “Public_html\sites\default”
4) Open "settings.php" to edit
5) Scroll down and edit the following lines in "settings.php"
- 'database' => 'localdbname', //enter the name of the new database
- 'username' => 'root',//enter the username of the new user created for the database
- 'password' => 'root', //enter the password of the new user created for the database
6) Save the "settings.php"
You can also edit the "settings.php" before uploading the site files to the live server in step "E" .
G) Testing your website
Open the website in a browser by it's url : www.yoursite.com and see if the site opens.
If the above process was followed correctly, and the settings files are updated with the database and user details created, the site should work correctly.
No comments