Making backups is a very important task in computer work. Everybody knows that a backup is necesseray. You really need a mean of recovering from a disaster. A disaster can occur for many reasons, especially errors you could personnally make, like removing a file on astahost server or destroying a table in your database.
A backup of your file will allow recovering from a file-type disaster. A backup of your database will allow you to recover from data disaster.
You backup your astahost files using ftp, and you backup your data with database tools.
However, how can you be sure that your backup is correct ?
A backup you never tested is not a safe backup.
The best way to test your backup is trying to use your backup in order to move your forum to another location, for instance to another web hosting provider.
I tried this in order to be sure that my backups were correct, and I first found it tricky.
Of course, there are some papers describing how to do this, for instance here http://www.phpbb.com...nother location
After a couple of hours, I realized that things would have been far simpler if I had a set of step-by-step instructions. So, I decided to write my own one. I hope it will be helpful for some of us.
This jobs looks very similar to a disaster-recovery type backup test : reading the data on a system, and testing them on another one. So, let’s first clarify the naming conventions I will use hereafter.
I will name “old site” or “old forum” your current PHPBB2 forum at astahost, the one you are currintly reaching at an address like http://yourname.asta.../myfamilyforum/ . This site has a lot of posts in the forum.
I will name “new site” or “new forum” the phpbb2 forum you just create at a new location (let’s say at lycos or micromania or even on your own PC). This forum has no posts yet, and after
STEP ONE : BACKUP YOUR CURRENT SITE.
At any moment, you need to backup your current site. You never know, a catastrophy may occur. So, make your backup right now.
In order to perform this, connect to your phpbb forum, login as administrator, and go to the administration pannel.
Then, click on “backup”. Here is where the “backup” button is :
STEP TWO : CREATE YOUR NEW FORUM AT YOUR NEW LOCATION. .
First of all, create a new site somewhere else, the ideal case is going to a completely new webhosting provider, for instance lycos. You don’t Lycos because it has too many ads? No problem, you simply want to test your backup-restore methodology, nobody else than you will see your new forum.
You can also install php and mysql on your own PC, using easyphp, which is an alternate method.
Install your new forum, and verify that you can connect to your new forum and to your forum admin pannel.
Just a small detail : at the end of the installation, you are asked to delete the “install” and the “contrib” foldes. Don’t simply delete them, simply rename them : rename “install” to “install_save” and rename “contrib” to “contrib_save”.
STEP THREE : BACKUP YOUR NEW SITE.
Use the forum admin control pannel in order to make a “just in case” full backup of your new forum database.
We will also make a partial backup, in order to save a single table. The reason is simple :
Right now, your new forum is empty, only the configuration table is important. We will make a backup of this table, using phpmyadmin. Your new site probably has a control pannel providing phpmyadmin. If you don’t have phpmyadmin, you can get it here : http://www.phpmyadmi...loads.php#2.8.2
STEP FOUR : REMEMBER YOUR NEW SITE SETTINGS.
Connect to your just installed forum, you see that there are no posts yet.
go to the administrator pannel.
Look at the values the installation script has installed, these settings are important for the rest of the migration job. Take note of the domain name and the script path name :
And also remember the cookie domain, the cookie name and the cookie path :
STEP FIVE : RESTORE YOUR ORIGINAL SITE DATABASE TO THE NEW LOCATION FORUM.
In your new forum administration menu, click the “restore database” button. You will be asked the name of the original backup you did at the very beginning.
Now open your new forum, you will see all your posts there !
Unfortunately, the job is not finished yet!
STEP 6 : OPTIONALLY, FORUM VERSION UPGRADE.
If your old forum was installed long time ago, it has probably been installed with an old veresion of php (for example my current production forum at astahost is release 2.0.15), whereas the new forum you will probably have a more up-to-date version, probably 2.0.21.
If this is the case, after restauring the old database to the new site, you simply have to run the script config_save/update_to_latest.php
If you forget this step and your original forum had a really old version, you could experience strange message errors like :
Once you finished updating, the work is almost finisthed.
Error in obtaining userdata
SQL Error : 1054 Unknown column 'user_login_tries' in 'field list'
SELECT user_id, username, user_password, user_active, user_level, user_login_tries, user_last_login_try FROM phpbb_users WHERE username = 'zebigboss'
Line : 65
File : login.php
STEP SEVEN : ALMOST FINISHED, BUT NOT YET COMPLETED .
Now, try to login to your new forum. You will see something strange : you wil notice that you are back to your old astahost forum !
This is due to the fact that, when restoring you old database, you also restored the old forum settings, and a lot of settings are redirecting to the old forum.
There are two ways of fixing this.
THE SIMPLER WAY.
The simplest way is using phpmyidmin and restore the phpbb_config table from the backup you took from the new site fresh install.
This is the simplest and the fastest way. It will work immediately. Just a small detail : you will have to provide again the infos concerning the administrator avatar and the administrator signature.
A SMARTER WAY.
The smarter way is using your old database backup, simply modifying the bad values from phpbb_config table. So, just after restoring your old database backup, using phpmyadmin, open the table phpbb_config and change the values of the domain name and the script path name, as well as the value of the cookie domain, the cookie name and the cookie path
Here below you can see where these values are located and how they look like. In my case the server_name is 127.0.0.1, the script_path is /forum/, the cookie_name is phpbb2mysql and the cookie_path is / :
THAT’S ALL ! .
Your work is finished now. Simply connect to your new forum, you will see that you are able to connect, to read all your posts exactly as there were in the old forum, you can perform adminstrative tasks, you see that you performed a perfect migration from your old forum on your old hosting provider, to your new forum on your new location. Seven easy steps allowed you to perform a perfect backup-restore test.
Now you know that you do have a perfect backup of your old site, and you do know how to restore it at any moment, to any location.