Pages

Wednesday, November 25, 2009

Uploading Joomla to your web (hosting) server

After having developend and tested your website on a local server, the next big challenge is uploading the website to your web server, and updating the configuration such that you "go live". The tutorial below gives you the steps required to move your Joomla website from your local computer to a server. With a few tweaks these steps also apply to moving Joomla from one host to another.


Upload all files to your web server

The first thing you need to do is transfer the files to the web server where your live site will be hosted. To be able to do this, you will need FTP (FTP is a way of allowing easy transfer of files across the web) access to your web server. FTP access typically consists of:

  • FTP Address - typically this is something similar to ftp.yourdomain.com
  • FTP Login details - username / password to access the ftp area
This information is given to you when you apply for a hosting account with any hosting company. To access the FTP area you will need an FTP client. A free and easy to use ftp client is FileZilla. Download and install this client and then enter the information to your ftp area. These should be similar to the image below:
-->
Image
Once you have connected to your webserver, upload all the files to the host. This is done by selecting all the Joomla files from your local hard drive and dragging them to the window which is connected to the host. This will start transfer of all your Joomla files to your hard disk.
Note: if you host has already installed Joomla for you, do not overwrite the configuration.php files. This contains very important details regarding the your Joomla host. You should keep a backup copy of this file. All other files can be overwritten, such that you have all the configuration you have done on the local installation.

Export / Import the Joomla database

Warning: the following steps about exporting / importing the joomla database are significantly technical. Please be aware of what you are doing because you may create a real mess.
The next step to tranfer the site you have created locally to the web server is the transfer of the Joomla database from your local MySQL, to the webserver database. This consists of two steps
  • Exporting your current local database
  • Importing the exported database to the MySQL database on the hosting company's server

Export the local Joomla database

To export your current database you need to use the phpMyAdmin located on your local server and export the database. The phpMyAdmin URL differs depending on the local development server you are using. If you are using XAMPP to test and develop you website, you will find phpMyAdmin at http://localhost/phpMyAdmin
Choose the database which contains the website you want to upload, and export it to a file. This step depends very much on the phpMyAdmin you are using. However, there should be an Export link. Export all the tables. Once the database has been export to a .sql file, you should open the file with a text editor, and check that the file looks ok. It should contain the Joomla tables. Make sure there isn't a Create database line. The database should be created manually.

Import to the hosting MySQL database

Once you have exported the database, you need to import on the host. Your hosting company should be able to provide you with access to MySQL. If you still haven't created a database you should create it now. Take note of all details, especially the address of the server where the MySQL resides, the name of the database, username and password to access the database. If the Joomla database has already been created previously (using the Joomla installation procedure or otherwise) you should use the details given to you when creating the database.
Log on to the phpMyAdmin interface, find the import tab, and import the file you have exported above. Once again, the location of the Import link varies depending on the phpMyAdmin version being used, however this should be fairly intuitive.

Configure

Up to now, if you try to access your website, you will probably be given an error. This is because the configuration.php file you had on your local server does not contain the information related to your hosting account details. As stated previously, if your host has already installed Joomla for you, you should leave the configuration.php file created unchanged. Otherwise you will need to change the following critical details:

Joomla 1.5

  • var $host = 'localhost'; - this is the address of the server which is hosting your MySQL database
  • var $user = 'sqluser'; - this is the name of the username which will be used to access the Joomla MySQL database
  • var $password = 'p@ssw0rd'; - password for MySQL database
  • var $db = 'j15stable'; - MySQL Joomla database name
  • var $log_path = '\home\logs'; - the path where any log files will be stored
  • var $tmp_path = '\home\tmp'; - the path for tmp files

Joomla 1.0

  • $mosConfig_host = 'mysql.youhost.com' - this is the address of the server which is hosting your MySQL database
  • $mosConfig_user = 'joomla_joomla' - this is the name of the username which will be used to access the Joomla MySQL database
  • $mosConfig_password = 'password' - password for MySQL database
  • $mosConfig_db = 'joomla_joomla' - MySQL Joomla database name
  • $mosConfig_absolute_path = '/home/xxxdomain/public_html/' - this the absolute path to your Joomla installation. This differs from host to host so you will probably need to contact your host to ask for this. This used because there are a number of core files / components files which use other files. These files are imported or referenced using the exact path to the file. If this setting is not correct, you will get a File Does not exist error.
  • $mosConfig_live_site = 'http://www.your-domain.com' - this is used so that Joomla can create links links. If you want your site and links to have a www, then put http://www.your-domain.com, if you don't want a www, the put http://your-domain.com. These settings need to be supported by your host.
  • $mosConfig_cachepath = '/home/xxxdomain/public_html/cache' - this is absolute path to the cache directory. The cache is used to increase the performance of your website. As you can see this is the same as the absolute path plus /cache (since this is the default directory where the cache files are stored.
Once all these entries in the configuration.php file have been given the correct values, Joomla should be able to access the database and code, and thus if you go to the address of your page, you should have a working Joomla website with all the customisation you have done. If not, one of the above settings is probably incorrect, or you might need to configure some settings further.

Test and secure the website

-->
Go through all the website, to make sure that everything has been setup correctly. Since you should have uploaded the website, most of your settings should be correct. However, you might still have some minor configurations to do, so go through each page and area to test the everything is working correctly.
You should also take all the steps to secure your Joomla website.

The Easy Way Out

As you can see, the steps are fairly complicated and require quite some knowledge of various technologies. This is not something which should be attempted by someone who does not have experience or who does not understand what is going on. If you think these instructions are too difficult to follow, use a third party component which will do all the dirty work for you. A recommended tool for this is the JoomlaCloner component. This allows you to move your Joomla installation easily.

1 comment:

Anonymous said...

great article. I would love to follow you on twitter.