How do you relocate your Joomla! 1.5+ website from one server to another?The idea of moving your Joomla! site may seem a bit daunting when you first think about it, especially if you've gone through the trouble of installing heaps of modules and custom components to get your site
exactly how you want it. In truth however, this task is actually quite easy.
1. Backup your mysql databaseJoomla! runs on top of a mysql database. I believe it may be possible to configure Joomla! to work with other types of databases but if you're reading this guide chances are your Joomla! install was setup to use the default database type: mysql. Most web servers that use mysql have
phpMyAdmin installed as a web based database administration tool. phpMyAdmin makes backing up your database easy!
[
Note: If you're web server doesn't have phpMyAdmin installed hop over to the mysql GUI tools page to obtain a copy of their free database administrator tool. If you need help with these tools feel free to respond with your questions and I'll be glad to help.]
Login to phpMyAdmin by entering the URL for your mysql database server into any web browser. This information should have been provided by your web host, but on the off chance you've lost it and can't get in touch with them you can find all the information you'll need in the
configuration.php file located in the root of your Joomla! website folder. See the values listed below.
var $host = 'mysql.mywebhost.com'; <-- Your mysql server URL
var $user = 'project88'; <-- Your username
var $db = 'project88'; <-- Your database
var $pass = 'password'; <-- Your password
Once you've logged in, click the databases link under mysql, select your database and click the
Export tab at the top. Be sure to make sure ALL database tables are selected, click the save as file check box and hit go. Save the file somewhere on your computer.
2. Backup and transfer your Joomla! siteEssentially you want to zip the entire site into a single zip file and then upload this file to your new site and unzip it there. There are scores of ways to do this so I won't go into detail here. If you're unsure how to do this ask your web host if they can create a site zip for you, and alternatively have them unzip it on your new site after you transfer the file.
I typically create a zip file called zippedsite.tgz and once uploaded to the new site I unzip it using a php page that contains the following code:
<?php
exec('tar -xzf zippedsite.tgz');
?>
3. Setup your new mysql database
Connect to your
new database server using phpMyAdmin like we did above but instead of clicking the export tab click the SQL tab instead. Open the database backup file you created with Notepad (Windows) or TextEdit (Mac) and copy the contents of the file into the SQL query window of phpMyAdmin and click go. If you're successful you should see a list of tables appear down the left side of the screen.
4. Configure Joomla! to work on your new serverOpen
configuration.php from the root folder of your new site and update the following values:
var $log_path = '<*see below>/logs';
var $tmp_path = '<*see below>/tmp';
var $ftp_host = 'ftp.yournew.server';
var $ftp_port = '21';
var $ftp_user = 'your_new_ftp_username';
var $ftp_pass = 'your_new_ftp_password';
var $ftp_root = '<*see below>';
var $host = 'mysql.newserver.com';
var $user = 'newproject';
var $db = 'newproject';
var $password = 'newpassword';
* - For the values above replace <*see below> with the absolute path for your new server. To find this value create a new php document that contains the following code:
<?php
phpinfo();
?>
Call this file whatever you want, I typically call it deleteme.php so I remember to remove it later. You don't want to leave this file on your server. It's a major security risk. Upload the file for now and navigate to it in your web browser. Search the results displayed for the string
_SERVER["DOCUMENT_ROOT"]. The value stored in this variable is your absolute path.
Once you've updated these values delete the temporary file deleteme.php and you should be good to go.