HomeBlogHow do you copy a joomla site from localhost to a remote...

How do you copy a joomla site from localhost to a remote host?

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. Eventually you may 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, for example www.domain.com, that you wish to keep while you work with Joomla!, you may be able to create a subdomain, for example, www.domain.com/subdirectory to hold your Joomla! site.

2, Copy Files and Directories of Your Local Joomla Directory to the Remote Host

You have two methods:

a. Upload all files by FTP or
b. Upload only a compressed file by FTP

a, Upload all Files by FTP

Normally, the easiest way to copy these files is using an FTP client program, such as Filezilla.

Select all files from directory localhost (with XAMPP, the directory will be xampp/www/directory) and upload to the remote host HTML directory for a domain, or to the remote host HTML subdirectory.

b, Upload a Compressed File

Copying a large number of individual files using FTP can sometimes be unreliable. If you have command-line access to the both source and destination systems you can create a compressed archive file containing all the files on the source system, then transfer that single file to the destination system where it can be decompressed.

Creating an archive file

On Unix-style systems (eg. Linux) you can use the gzip program to create .zip files, or the tar program to create .tar.gz or .tar.bz2 files. For detailed instructions type man gzip or man tar at the command line. For example,

tar cvfz joomlabackup.tar.gz /path-to-joomla

will create a gzip-compressed archive file, called joomlabackup.tar.gz, containing all the files in your Joomla! installation. Important note! You need to make sure you are NOT in the folder you are trying to backup when you run the tar command or you will create an endless loop.

Extracting an archive file

Having copied the archive file to the destination system, you now need to unpack it. Use the equivalent command that you used to create the archive file. For example, to unpack the archive file created in the example above, enter

cd /path-to-joomla
tar xvfz joomlabackup.tar.gz

If the user or group IDs are not the same between the source and destination systems, then you will need to amend the ownership of the files you just extracted. For example, on an Apache system, you might need to enter the command

cd /path-to-joomla
chown -R www-group.www-user *

Copy the Contents of Your Local MySQL Database to the Host MySQL Database

In Joomla!, all the contents of the site (articles, menus, users, and so on) are stored in the MySql database. 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. 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.

Check the “Save as file” box at the bottom of the screen, and enter the name of the export file.

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.

Open up the phpMyAdmin on the host server > Select the Import tab > Click the Browse button under “File to import”, then select the database file from your computer.

Click Go to import the database > At this point you have installed the database.

If you want to create a database copy, you can use also the MYSQL command line method. Usually you run mysqldump to create a database copy:

$ mysqldump -u user -p db-name > db-name.out

Copy db-name.out file using sftp/ssh to remote MySQL server:

$ scp db-name.out [email protected]:/backup

Restore database at remote server (login over ssh):

$ mysql -u user -p db-name < db-name.out

Configure the Site. Edit the configuration.php File

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:xampphtdocsjoomla15logs’;
var $tmp_path = ‘C:xampphtdocsjoomla15tmp’;
var $live_site = ”;
var $host = ‘localhost’;
var $user = ‘root’;
var $db = ‘your_local_db_name’;
var $password = ‘your_local_db_password’;

Now, at you remote host system, the settings in the configuration.php file that you typically need to change are shown below

var $log_path = ‘/var/www/vhost/domain.com/home/html/logs’;
var $tmp_path = ‘/var/www/vhost/domain.com/home/html/tmp’;
var $live_site = ”;
var $host = ‘name your remote host’;
var $user = ‘your_user_db_name’;
var $db = ‘your_db_name’;
var $password = ‘your_db_password’;

If you uploaded Joomla! files to a subdirectory, remember that you are working on subdirectory, and the settings that you need, will be,

var $log_path = ‘/var/www/vhost/domain.com/subdirectory/html/logs’;
var $tmp_path = ‘/var/www/vhost/domain.com/subdirectory/html/tmp’;
var $live_site = ”;
var $host = ‘name your remote host’;
var $user = ‘your_user_db_name’;
var $db = ‘your_db_name’;
var $password = ‘your_db_password’;

At this point, your Joomla! Website on your host should be operational with the same information as your localhost site. If you installed it on a subdirectory, navigate to that subdirectory to see or administer the site.

(for navigatation to the site)

(login to the Joomla admin area with your user and password that your had at your localhost installed)

-and if you installed it on root directory to see the site

https://www.domain.com/ (for navigatation to the site)

(login to admin area)

Ref: http://docs.joomla.org/How_do_you_copy_a_site_from_localhost_to_a_remote_host%3F


 

Here is comparison of both Local host and remote host ‘configuration.php’ file. I added spaces to get the exact line comparison.

Local Host configuration.php file Remote Host configuration.php file
  • <?php
    class JConfig {
    /* Site Settings */
    var $offline = ‘0’;
    var $offline_message = ‘This site is down for maintenance.<br /> Please check back again soon.’;
    var $sitename = ‘Joomla Test Site;
    var $editor = ‘tinymce’;
    var $list_limit = ’20’;
    var $legacy = ‘0’;
    /* Debug Settings */
    var $debug = ‘0’;
    var $debug_lang = ‘0’;
    /* Database Settings */
    var $dbtype = ‘mysql’;
    var $host = ‘localhost’;
    var $user = ‘root’;
    var $password = ”;
    var $db = ‘joomla database’;
    var $dbprefix = ‘jos_’;
    /* Server Settings */
    var $live_site = ”;
    var $secret = ‘QvGN1125478AE11nfj6OiBD’;
    var $gzip = ‘0’;
    var $error_reporting = ‘-1’;
    var $helpurl = ‘http://help.joomla.org’;
    var $xmlrpc_server = ‘0’;
    var $ftp_host = ‘127.0.0.1’;
    var $ftp_port = ’21’;
    var $ftp_user = ”;
    var $ftp_pass = ”;
    var $ftp_root = ”;
    var $ftp_enable = ‘0’;
    var $force_ssl = ‘0’;
    /* Locale Settings */
    var $offset = ‘0’;
    var $offset_user = ‘0’;
    /* Mail Settings */
    var $mailer = ‘mail’;
    var $mailfrom = ‘[email protected]’;
    var $fromname = ‘Joomla Test Site’;
    var $sendmail = ‘/usr/sbin/sendmail’;
    var $smtpauth = ‘0’;
    var $smtpsecure = ‘none’;
    var $smtpport = ’25’;
    var $smtpuser = ”;
    var $smtppass = ”;
    var $smtphost = ‘localhost’;
    /* Cache Settings */
    var $caching = ‘0’;
    var $cachetime = ’15’;
    var $cache_handler = ‘file’;
    /* Meta Settings */
    var $MetaDesc = ‘Joomla! – the dynamic portal engine and content management system’;
    var $MetaKeys = ‘joomla, Joomla’;
    var $MetaTitle = ‘1’;
    var $MetaAuthor = ‘1’;
    /* SEO Settings */
    var $sef           = ‘0’;
    var $sef_rewrite   = ‘0’;
    var $sef_suffix    = ‘0’;
    /* Feed Settings */
    var $feed_limit   = 10;
    var $feed_email   = ‘author’;
    var $log_path = ‘D:wampwwwteslogs’;
    var $tmp_path = ‘D:wampwwwtestmp’;
    /* Session Setting */
    var $lifetime = ’15’;
    var $session_handler = ‘database’;
    }
    ?>
  • <?php
    class JConfig {
    var $offline = ‘0’;
    var $editor = ‘tinymce’;
    var $list_limit = ’20’;
    var $helpurl = ‘http://help.joomla.org’;
    var $debug = ‘0’;
    var $debug_lang = ‘0’;
    var $sef = ‘1’;
    var $sef_rewrite = ‘0’;
    var $sef_suffix = ‘0’;
    var $feed_limit = ’10’;
    var $feed_email = ‘author’;
    var $secret = ‘c947c29396a3cb66725885647ad01a978ef14’;
    var $gzip = ‘0’;
    var $error_reporting = ‘-1’;
    var $xmlrpc_server = ‘1’;
    var $log_path = ‘./logs’;
    var $tmp_path = ‘./tmp’;
    var $live_site = ‘http://joomlatestsite.com’;
    var $force_ssl = ‘0’;
    var $offset = ‘-5’;
    var $caching = ‘1’;
    var $cachetime = ’15’;
    var $cache_handler = ‘file’;
    var $memcache_settings = array();
    var $ftp_enable = ‘0’;
    var $ftp_host = ”;
    var $ftp_port = ‘0’;
    var $ftp_user = ”;
    var $ftp_pass = ”;
    var $ftp_root = ”;
    var $dbtype = ‘mysql’;
    var $host = ‘host database .hostedresource.com’;
    var $user = ‘remote database name’;
    var $db = ‘remote database’;
    var $dbprefix = ‘jos_’;
    var $mailer = ‘smtp’;
    var $mailfrom = ‘[email protected]’ ‘;
    var $fromname = ‘joomlatestsite.com’;
    var $sendmail = ‘/usr/sbin/sendmail’;
    var $smtpauth = ‘0’;
    var $smtpsecure = ‘none’;
    var $smtpport = ’25’;
    var $smtpuser = ”;
    var $smtppass = ”;
    var $smtphost = ‘relay-hosting.secureserver.net’;
    var $MetaAuthor = ‘1’;
    var $MetaTitle = ‘1’;
    var $lifetime = ’15’;
    var $session_handler = ‘database’;
    var $password = ‘database password’;
    var $sitename = ‘Joomla Test Site;
    var $MetaDesc = metadata of your site.’;
    var $MetaKeys = metadats of your site.’;
    var $offline_message = ‘This site is down for maintenance. Please check back again soon.’;
    }
    ?>

Disclosure: Mashtips is supported by its audience. As an Amazon Associate I earn from qualifying purchases.

11 COMMENTS

  1. Came here by Google looking for answers on embedding maps on my page and just wanted to say thank you for your help!

  2. I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will find that very useful.

  3. How to move windows 7 Ultimate license from 1 PC to an other. The original PC will be upgraded with a new license 64 bit however original CD was on 32bit so I will move that to my laptop.

  4. I have to state, you chose your words well. The ideas you wrote on your encounters are well placed. This is an incredible blog!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

You May Like

More From Author