Tuesday, June 29, 2010

Uploading local Joomla site to sadomain

***This post was cracked at some point and I haven't had time to recover the images - 01-02-2012
This post is based on an article I got from Joomla Documentation. I modified the content where I felt applicable to SA Domain. Please excuse the style of writing… this is meant to be a technical post and will remain as close to what my lab notes currently look like.

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 that 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 (SA Domain in this case).
Here are the steps:
1 Create a place on your remote host to install Joomla!. This will already be created for you by the Techies at SA Domain after first payment.
2 Copy files and Directories of your local Joomla Directory to remote host.
4 Configuration Site. Edit configuration.php

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.

Copy files and Directories of your local Joomla Directory to remote host.

You have 2 methods, Upload all files by FTP or Upload only a file compresed by Ftp. I didn’t use the compressed method because it requires command line access of the source and destination systems. Then you can create a compressed archive file containing all the files on the source system and transfer that single file to the destination system where it can be decompressed.

Upload all Files by FTP

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

Select all files from directory localhost, with XAMPP the directory will be xampp/www/directory (C:\xampp\htdocs\joomla15), and upload to remote host root directory.

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. 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 its 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.
  • 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, as shown below:
  • 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
Some things to watch out for that bit me:
The SQL file that you exported from localhost may contain the following SQL query:
CREATE DATABASE `joomla15` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `joomla15`;
You need to delete or comment this statement out. As a client you’re not given the privilege to create databases. In most cases you’ll find that the database has been created for you and you just need to create the tables.
In my previous projects I never had this issue and I wish I could explain why it happened this time. I suspect it’s some configuration setting I changed when playing around with JoomFish. I’m not an SQL guru and my memory has had better days before my encounter with alcohol.
At this point you have installed the database. If you don’t want to do fancy/geeky stuff then you may skip the remainder of this section and move to the next step (Editing the config file).
If you want , to create database copy, you can use also 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 user@remote.box.com:/backup
Restore database at remote server (login over ssh):
$ mysql -u user -p db-name <>

Editing the config file (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';
Now, at your 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';
The following is an example of an sadomain one:
class JConfig {
/* Site Settings */
var $offline = '0';
var $offline_message = 'This site is down for maintenance.
Please check back again soon.';

var $sitename = 'My Site Name';
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 = 'domainname.co.za';
var $user = 'username';
var $password = 'passwordSentBySADomain';
var $db = 'domainname';
var $dbprefix = 'jos_';
/* Server Settings */
var $live_site = '';
var $secret = 'UtAcJKMVqYJgv51A';
var $gzip = '0';
var $error_reporting = '-1';
var $helpurl = 'http://help.joomla.org';
var $xmlrpc_server = '0';
var $ftp_host = '196.25.120.17';
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 = 'peter.peele@gmail.com';
var $fromname = 'Site Name';
var $sendmail = '/usr/sbin/sendmail';
var $smtpauth = '0';
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 $log_path = '/logs';
var $tmp_path = '/tmp';
/* Session Setting */
var $lifetime = '15';
var $session_handler = 'database';
}
?>
Note that if you had uploaded files directory joomla for 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';
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 subdirectory, navigate to that subdirectory to see or administer the site.
http://www.domain.com/subdirectory ( for navigate ) http://www.domain.com/subdirectory/administrator ( login to the joomla admin area with your user and password that your had at your localhost instaled)
and if you installed it on root directory to see the site
http://www.domain.com/ ( for site navigation) http://www.domain.com/administrator ( for logging into admin )

No comments:

Post a Comment