Backup and Restore Drupal Website

Backup and Restore Drupal Website

How To Backup and Restore a Drupal Installation

Many webmasters who use Drupal, but aren’t aware about the process taking backup and restore it. This may be due to the lack of knowledge about the importance of backup.

There exists 4 primary scenarios when having the latest backup files are essential:

A. When users upgrade to a higher edition of Drupal, it is suggested to keep a backup of your database and other files. Incase you come across an issue during the upgrade, there are chances of losing data, having a backup would fade-out the chances of data loss.

B. Incase the current server faces an issue or you are switching from a hosting provider to Eukhosts affordable web hosting servers, having a back-up of your own, can reduce the chances of data loss. You can simply upload the backed up file and proceed normally with your activities.

C. With an increase in the number of attacks recently, there is a possibility that you become the victim and all your data is gone. So, as a counter-active measure, you can upload the back up and work as if nothing had happened.

D. If you intend creating a test website of your Drupal installation, or you wish to test modules and templates, then a backup proves highly essential. Therefore, inorder to avoid issues, it is suggested to avoid testing in a live environment.

Affordable Web Hosting

There have been number of instances in the past where the entire website content was washed out due to attacks, hacks, during testing etc. If they had a backup or if their web hosting provider was capable enough to take regular backups, things could have been reverted.

How to go about taking a backup of your Drupal website ?

Using a module, users can take backup of each file and database and club it into a single tar.gz file. The simplest method of restoring the files, is by uploading it via. a FTP client onto the server. Further, SSH using PuTTy to the command directory and enter the following in the command line:

tar -xvvzf drupalbackup.tar.gz

This would extract the files and the drupal-backup.sql.gz as well.

If you are changing the website location i.e. switching from domainnameA to domainnameB or moving the data over to a sub-domain everything mentioned would be required since the same database would be used. Your website would still function normally but from a different domain/sub-domain name. But, you need to bear in mind that the site is still using the same database.

In this case, there are certain aspects that must be considered. You must make sure that the site is functional from the old location, as this would be considered to be content duplication by the search engines and might penalise you. To avoid that, using phpmyadmin, you must make a new database. Make changes to the Drupal config files in a way that it reads the new database.

\sites\default\settings.php

Need to know information :

It might be possible that the file is set as read-only by default. Incase you make amendments to it, get assured that the file permissions aren’t left writable which can make you prone to attacks and can be prone to security risks.

You can see that the file would have only two lines :

$db_url = ‘mysql://account:[email protected]/dbname’;

$db_prefix = ”;

You simply need to replace the dbname with your database name in phpmyadmin. FYI. the account name and the password is same as that of your MySQL account.

Also, make sure that the latest ‘settings.php’ file has been uploaded as well. Since the file is usually set as read-only, the FTP client might not allow you to upload and replace the existing file over the server. In that case, you are required to ‘delete‘ the file on the server. Then try accessing your site in a browser, you would probably be given an error saying “Unsupported database type”. Upon uploading the new settings.php file and refreshing the browser, a blank page would be displayed. This is a pointer towards the fact that the database isn’t accessible. Now, you must upload the backup of your database and then refresh the browser. You should be able to access your website normally.

Note : Having your Drupal website backup using any of the Offsite Backup Plans can help you keep your website data secure.

Sharing

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.