Difference between revisions of "Copying a website from localhost to a remote host"

From Joomla! Documentation

(in process)
(add screenshots)
Line 5: Line 5:
  
 
#'''Create a place on your remote host to install Joomla!.'''  If this is a new site, it will just be your home directory. If you have an existing site that you wish to keep while you work with Joomla!, you may be able to create a subdomain to hold your Joomla! site. Make sure you note the subdomain name for later. The details of creating a subdomain will vary by host, so you will need to check with your host on this.
 
#'''Create a place on your remote host to install Joomla!.'''  If this is a new site, it will just be your home directory. If you have an existing site that you wish to keep while you work with Joomla!, you may be able to create a subdomain to hold your Joomla! site. Make sure you note the subdomain name for later. The details of creating a subdomain will vary by host, so you will need to check with your host on this.
#'''Install Joomla! on your host site.''' Again, the procedure for this will vary from host to host. Many hosts have custom scripts for installing Joomla! that make it very easy. Check with your host if you are not sure how to do this.
+
#'''Install Joomla! on your host site.''' Again, the procedure for this will vary from host to host. Many hosts have custom scripts for installing Joomla! that make it very easy. Check with your host if you are not sure how to do this. In the installation, you do not need to create the sample website, since we will be replacing all of the contents of this database.
#'''Copy custom files from your local site to your remote site.''' This step will depend on what you have customised in the local site. At a minimum, you have probably added some image files. You also might have installed some extensions, customised the template, or added some template overrides. If you have done a significant amount of customisation, the safest thing to do is to copy all of the files and folders from your local Joomla! folder to your host folder ''except for the file "configuration.php".'' No '''NOT''' replace this file on your host.
+
#'''Copy custom files from your local site to your remote site.''' This step will depend on what you have customised in the local site. At a minimum, you have probably added some image files. You also might have installed some extensions, customised the template, or added some template overrides. If you have done a significant amount of customisation, the safest thing to do is to copy all of the files and folders from your local Joomla! folder to your host folder ''except for the file "configuration.php".'' No '''NOT''' replace this file on your host. Normally, the easiest way to copy these files is using an FTP client program, like [http://filezilla-project.org/ Filezilla]. Your host will provide you with the FTP site name and your FTP username and password.
#Next, you need to copy the contents of your local MySQL database to the host MySQL database. This is done by creating an export file locally, copying the export file to the host server, and then importing the file into your host MySQL dabase, as follows:
+
#'''Copy the contents of your local MySQL database to the host MySQL database.''' In Joomla!, all of the contents of the site (articles, menus, users, and so on) are stored in the MySql database. So you need to copy this information to the host database. This is done by creating an export file on your local system and then importing this file into your host MySQL database, as follows:
 
## Open phpMyAdmin on your local system by navigating to it's URL with your browser. On your local system, this URL will normally be "//localhost/phpmyadmin". Note: If you have a password on your database, you will be prompted for it.
 
## Open phpMyAdmin on your local system by navigating to it's URL with your browser. On your local system, this URL will normally be "//localhost/phpmyadmin". Note: If you have a password on your database, you will be prompted for it.
 
## The phpMyAdmin screen will display as shown below. Select the Export link.[[Image:screenshot_phpmyadmin1.png|frame|center]]
 
## The phpMyAdmin screen will display as shown below. Select the Export link.[[Image:screenshot_phpmyadmin1.png|frame|center]]
Line 13: Line 13:
 
## Check the "Save as file" box at the bottom of the screen, and enter the name of the export file, as shown below. .[[Image:screenshot_phpmyadmin3.png|frame|center]]
 
## Check the "Save as file" box at the bottom of the screen, and enter the name of the export file, as shown below. .[[Image:screenshot_phpmyadmin3.png|frame|center]]
 
## Press the "Go" button in the lower right corner. An Open / Save / Cancel dialog will display. Press Save and select a folder to save the file in. The export will complete and the file will be saved in the chosen location.
 
## Press the "Go" button in the lower right corner. An Open / Save / Cancel dialog will display. Press Save and select a folder to save the file in. The export will complete and the file will be saved in the chosen location.
## Copy the export file to a folder on the DreamHost server, for example using FTP.
+
## Open up the phpMyAdmin on the host server. Your host should give you instructions for how to do this.
## Open up the phpMyAdmin on the DreamHost server. To do this, open your browser and navigate to the URL "http://" followed by the MySQL host name you named when you installed Joomla!. For example, if your MySQL host name is "mydatabase.joomla15.mywebsite.com", the URL for phpMyAdmin would be http://mydatabase.joomla15.mywebsite.com. You will be prompted to enter your MySQL user name and password that you created when you installed Joomla!.
 
 
## At this point, you need to import the contents of the export file created above. Before you can do that, however, all of the data from the existing Joomla! database must be deleted. An easy way to do that is to select the MySQL database for Joomla! from the drop-down list box in the upper left, as shown below.[[Image:screenshot_phpmyadmin4.png|frame|center]]
 
## At this point, you need to import the contents of the export file created above. Before you can do that, however, all of the data from the existing Joomla! database must be deleted. An easy way to do that is to select the MySQL database for Joomla! from the drop-down list box in the upper left, as shown below.[[Image:screenshot_phpmyadmin4.png|frame|center]]
 
## The list of tables in the selected database will display. We want to delete all of these tables, since the Import will re-create them. Scroll down to the bottom of the list and select the "Check All" link. This will select all tables in the list. Then, in the drop-down list to the right of the Check All link, select "Drop", as shown below.[[Image:screenshot_phpmyadmin5.png|frame|center]]
 
## The list of tables in the selected database will display. We want to delete all of these tables, since the Import will re-create them. Scroll down to the bottom of the list and select the "Check All" link. This will select all tables in the list. Then, in the drop-down list to the right of the Check All link, select "Drop", as shown below.[[Image:screenshot_phpmyadmin5.png|frame|center]]
 
## You will be asked to confirm that you really want to do this (since you are in effect deleting the entire database). Press Yes and you should get a message indicating that the query was successful.
 
## You will be asked to confirm that you really want to do this (since you are in effect deleting the entire database). Press Yes and you should get a message indicating that the query was successful.
## With the database still selected, press the Import Link at the top of the screen and browse to the location in your DreamHost folder where the .SQL export file was uploaded. Press Open to select the file and then press Go (lower left corner) to start the import. Again, you should get a message indicating that the query was successful.
+
## With the database still selected, press the Import Link at the top of the screen and browse to the location in your host folder where the .SQL export file was uploaded. Press Open to select the file and then press Go (lower left corner) to start the import. Again, you should get a message indicating that the query was successful.
  
Congratulations! At this point, your Joomla! website on DreamHost should be operational with the exact same information as your localhost site. If you installed it on a DreamHost subdomain, navigate to that subdomain to see or administer the site. For example, if your subdomain was named "mysubdomain", then navigating to http://www.mysubdomain.mywebsite.com should bring up your home page and http://www.mysubdomain.mywebsite.com/administer should bring up the login to the Joomla! admin area.
+
Congratulations! At this point, your Joomla! website on your host should be operational with the exact same information as your localhost site. If you installed it on a subdomain, navigate to that subdomain to see or administer the site. For example, if your subdomain was named "mysubdomain", then navigating to http://www.mysubdomain.mywebsite.com should bring up your home page and http://www.mysubdomain.mywebsite.com/administer should bring up the login to the Joomla! admin area.
  
##Copy all of your Joomla! files and folders from your localhost Joomla! folder to the remote host Joomla! folder and manually edit the "configuration.php" file. If it is difficult or impossible to install Joomla! on your remote system, then this is the best approach. This means you will need to edit the configuration.php file manually and create the Joomla! MySql database manually.
+
'''Alternate Procedure If You Cannot Install Joomla!'''
##*The file "configuration.php" is the only file that contains settings specific to your system. So this file must be edited to match the host system. This file was created for you when you installed Joomla! on your localhost. The settings in the configuration.php file that you need to change are shown below. This example is from a Windows XP localhost system.  
+
In some cases, it is not possible to install Joomla! on a host using the normal installation procedure. In this case, we modify the steps (2) and (3) above as follows:
 +
 
 +
*Copy ALL files from the local Joomla! directory to the host Joomla! directory, ''including'' "configuration.php".  
 +
*Manually edit "configuration.php" to tell Joomla! about your site. The file "configuration.php" contains settings specific to your system. This file was created for you when you installed Joomla! on your localhost. The settings in the configuration.php file that you typically need to change are shown below. This example is from a Windows XP localhost system.  
 
<source lang="php">
 
<source lang="php">
 
var $log_path = 'C:\\xampp\\htdocs\\joomla15\\logs';
 
var $log_path = 'C:\\xampp\\htdocs\\joomla15\\logs';
Line 33: Line 35:
 
var $password = 'your_local_db_password';
 
var $password = 'your_local_db_password';
 
</source>
 
</source>
:::*The values for $log_path and $tmp_path point to paths on your remote host system. These will typically be provided to you by your host. Or, if you know your home directory on the host system, use this directory and a "logs" and "tmp" subdirectory. The $live_site variable is just the URL of your site. The $host variable will be given to you by your host. The $user variable is the MySql user name. This is typically "root" on a localhost but will normally be a different name on a remote host. The $db variable is the name of the database and $password is the password this user uses to access the database.
+
 
:::*If you use phpMyAdmin to create the database on the remote host, you will be provided a $user and $password by your host and will choose the $db when you create the database. Normally, the database name will include your URL or some other mechanism to make it unique across all of the sites being hosted by your host.
+
**The values for $log_path and $tmp_path point to paths on your remote host system. These will typically be provided to you by your host. Or, if you know your home directory on the host system, use this directory and a "logs" and "tmp" subdirectory.  
 +
**The $live_site variable is just the URL of your site.  
 +
**The $host variable is often "localhost" and will be given to you by your host.  
 +
**The $user variable is the MySql user name. This is typically "root" on a localhost but may be a different name on a remote host. If you created the MySql database manually, you can use the username you used for phpMyAdmin. Otherwise, your host will provide this.
 +
**The $db variable is the name of the database.
 +
**The $password variable is the password this database user uses to access the database. Note that this may not be the same as used to access the Joomla! back end.
 +
 
 +
*Create the Joomla! database, typically using phpMyAdmin. You should be provided a $user and $password by your host and you will choose the $db name when you create the database. In a shared hosting environment, the database name may include your URL or some other mechanism to make it unique across all of the sites being hosted by your host.
 +
 
 +
At this point, continue on to step (4) "Copy the contents of your local MySQL database to the host MySQL database".
  
 
[[Category:FAQ]]  
 
[[Category:FAQ]]  
 
[[Category:Getting Started]]
 
[[Category:Getting Started]]
 
[[Category:Upgrading and Migrating FAQ]]
 
[[Category:Upgrading and Migrating FAQ]]

Revision as of 17:35, 6 August 2008

Quill icon.png
Page Actively Being Edited!

This article is actively undergoing a major edit for a short while.
As a courtesy, please do not edit this page while this message is displayed. The user who added this notice will be listed in the page history. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page. If this page has not been edited for several hours, please remove this template, or replace it with {{underconstruction}} or {{incomplete}}.

When you are first trying out Joomla!, it is often recommended that you install it on your local system (e.g., "localhost"), for example with XAMPP, and get your site running locally. In this case, you may do enough work on your local Joomla! site that you want to copy this site to your remote host. Fortunately, this is easy to do.

This article assumes you have installed Joomla! 1.5 on your local computer, you have created a website, and you now wish to copy this website to your remote host. Here are the steps:

  1. Create a place on your remote host to install Joomla!. If this is a new site, it will just be your home directory. If you have an existing site that you wish to keep while you work with Joomla!, you may be able to create a subdomain to hold your Joomla! site. Make sure you note the subdomain name for later. The details of creating a subdomain will vary by host, so you will need to check with your host on this.
  2. Install Joomla! on your host site. Again, the procedure for this will vary from host to host. Many hosts have custom scripts for installing Joomla! that make it very easy. Check with your host if you are not sure how to do this. In the installation, you do not need to create the sample website, since we will be replacing all of the contents of this database.
  3. Copy custom files from your local site to your remote site. This step will depend on what you have customised in the local site. At a minimum, you have probably added some image files. You also might have installed some extensions, customised the template, or added some template overrides. If you have done a significant amount of customisation, the safest thing to do is to copy all of the files and folders from your local Joomla! folder to your host folder except for the file "configuration.php". No NOT replace this file on your host. Normally, the easiest way to copy these files is using an FTP client program, like Filezilla. Your host will provide you with the FTP site name and your FTP username and password.
  4. Copy the contents of your local MySQL database to the host MySQL database. In Joomla!, all of the contents of the site (articles, menus, users, and so on) are stored in the MySql database. So you need to copy this information to the host database. This is done by creating an export file on your local system and then importing this file into your host MySQL database, as follows:
    1. Open phpMyAdmin on your local system by navigating to it's URL with your browser. On your local system, this URL will normally be "//localhost/phpmyadmin". Note: If you have a password on your database, you will be prompted for it.
    2. The phpMyAdmin screen will display as shown below. Select the Export link.
    3. Select the database you want to export in the upper right-hand list. In the example below, the database "joomla15" is selected. Keep all of the default options, including "SQL" as the export type.
    4. Check the "Save as file" box at the bottom of the screen, and enter the name of the export file, as shown below. .
      Screenshot phpmyadmin3.png
    5. Press the "Go" button in the lower right corner. An Open / Save / Cancel dialog will display. Press Save and select a folder to save the file in. The export will complete and the file will be saved in the chosen location.
    6. Open up the phpMyAdmin on the host server. Your host should give you instructions for how to do this.
    7. At this point, you need to import the contents of the export file created above. Before you can do that, however, all of the data from the existing Joomla! database must be deleted. An easy way to do that is to select the MySQL database for Joomla! from the drop-down list box in the upper left, as shown below.
    8. The list of tables in the selected database will display. We want to delete all of these tables, since the Import will re-create them. Scroll down to the bottom of the list and select the "Check All" link. This will select all tables in the list. Then, in the drop-down list to the right of the Check All link, select "Drop", as shown below.
    9. You will be asked to confirm that you really want to do this (since you are in effect deleting the entire database). Press Yes and you should get a message indicating that the query was successful.
    10. With the database still selected, press the Import Link at the top of the screen and browse to the location in your host folder where the .SQL export file was uploaded. Press Open to select the file and then press Go (lower left corner) to start the import. Again, you should get a message indicating that the query was successful.

Congratulations! At this point, your Joomla! website on your host should be operational with the exact same information as your localhost site. If you installed it on a subdomain, navigate to that subdomain to see or administer the site. For example, if your subdomain was named "mysubdomain", then navigating to http://www.mysubdomain.mywebsite.com should bring up your home page and http://www.mysubdomain.mywebsite.com/administer should bring up the login to the Joomla! admin area.

Alternate Procedure If You Cannot Install Joomla! In some cases, it is not possible to install Joomla! on a host using the normal installation procedure. In this case, we modify the steps (2) and (3) above as follows:

  • Copy ALL files from the local Joomla! directory to the host Joomla! directory, including "configuration.php".
  • Manually edit "configuration.php" to tell Joomla! about your site. The file "configuration.php" contains settings specific to your system. This file was created for you when you installed Joomla! on your localhost. The settings in the configuration.php file that you typically need to change are shown below. This example is from a Windows XP localhost system.
var $log_path = 'C:\\xampp\\htdocs\\joomla15\\logs';
var $tmp_path = 'C:\\xampp\\htdocs\\joomla15\\tmp';
var $live_site = '';
var $host = 'localhost';
var $user = 'root';
var $db = 'your_local_db_name';
var $password = 'your_local_db_password';
    • The values for $log_path and $tmp_path point to paths on your remote host system. These will typically be provided to you by your host. Or, if you know your home directory on the host system, use this directory and a "logs" and "tmp" subdirectory.
    • The $live_site variable is just the URL of your site.
    • The $host variable is often "localhost" and will be given to you by your host.
    • The $user variable is the MySql user name. This is typically "root" on a localhost but may be a different name on a remote host. If you created the MySql database manually, you can use the username you used for phpMyAdmin. Otherwise, your host will provide this.
    • The $db variable is the name of the database.
    • The $password variable is the password this database user uses to access the database. Note that this may not be the same as used to access the Joomla! back end.
  • Create the Joomla! database, typically using phpMyAdmin. You should be provided a $user and $password by your host and you will choose the $db name when you create the database. In a shared hosting environment, the database name may include your URL or some other mechanism to make it unique across all of the sites being hosted by your host.

At this point, continue on to step (4) "Copy the contents of your local MySQL database to the host MySQL database".