Karakas Online

26.2. How to restore PHP-Nuke from backup

Figure 26-1. Administration panel: Backup DB.

Administration panel: Backup DB.

Administration panel: Backup DB.



We have already seen that PHP-Nuke offers a built-in database backup function in the administration panel (Figure 26-2). phpMyAdmin (Section 3.3) also offers a very good web interface to database backups and you can even use home-made scripts that automate the backup work for you (see Section 27.16). However, we have not yet covered the procedures necessary to restore a backup made with the above procedures.

Figure 26-2. Administration panel: Backup DB.

Administration panel: Backup DB.

Administration panel: Backup DB.



PHP-Nuke can bee seen as a structure comprising two general elements, the files and the database. The pulsing heart of our dynamic CMS is the database. It is actually there where the we save all usernames, articles, statistics and all the rest. In the files, on the other hand, we have the commands that are necessary for a functioning connection to the database, the fetching and processing of the data and finally their saving back to the database again.

Although the database is experiencing constant modifications (UPDATEs) - practically every time some user is vieweing some page - the files themselves are subject to much slower change, most of the time due to necessary interventions of the administrator. If, for example, we have PHP-Nuke 6.8 installed, then the possible modifications to our installation include:

As you can see, if we were to lose our PHP-Nuke files, a recuperation would not be something impossible, although painful and annoying. On the other hand, it would be really impossible to recuperate our database data, if lost, due to the fact that they may change automatically, independently of the administrator's will. For example, the update of the statistics, a user's post in the forums, or a user registration, are all events that happen independently of the administrator's will and they all find their way to the database.

Hopefully, the above observations have convinced you of the necessity of database backups. We recommend you to:

Make a backup of your PHP-Nuke at least every time you make a change to them (although a regular backup every N days would be even better).

Make a database backup as often as possible. The backup frequency should be directly proportional to the number of visits that your site attracts per day: the more visits per day , the more new data is stored in our database each day. Also in this case, a regular backup is the recommended way.

Warning Don't trust your ISP on making backups of your data!
 

Do not, under any circumstances, indulge to the comforting thought that your ISP is doing database backups for you, even if he talks in his marketing brochures about "security", "crash protection" or even "backups"! If you read the Standard Terms and Conditions of your ISP carefully, you will almost certainly discover that he does not assume any responsibility for data loss, unless it was the result of gross negligence (a rare condition that you will have to prove in a court).

Even if your ISP does do backups, and runs big ads declaring so, this does not mean that he does them for you! You might discover that you have to pay an "market fair" hourly rate for the ISP's operator's work, if you ask his help on restoring that lost table of yours...

Thus, you'd better not rely on your ISP when it comes to backups. Do your homework and you will not regret it.

Restoring a backup is very simple. All you need to do is delete all tables contained in the PHP-Nuke database and insert the emergecy versions in their place. You can do this through the function "SQL query" of phpMyAdmin (see Section 3.4.2). Enter the full name of the backup file in the field for "textfile" in Figure 26-3, or select "Browse" and then search for it in the dialog that follows.

Figure 26-3. phpMyAdmin: SQL query.

phpMyAdmin: SQL query.

phpMyAdmin: SQL query.



However, it is important that we are aware of some exceptions or particular cases that may yield themselves the above restore procedure:

We will talk about these cases in the following subsections.

Last updated Sun Aug 7 21:14:12 CEST 2005 Permalink: http://www.karakas-online.de/EN-Book/restore-php-nuke-from-backup.html All contents © 2004 Chris Karakas, Claudio Erba