Difference between revisions of "Restoring WHMCS"

From WHMCS Documentation

(Created page with "Data loss is a catastrophic but not unheard of occurrence. Good backups will turn a potentially disastrous situation into regrettable downtime, but if complete backups are not...")
 
Line 1: Line 1:
Data loss is a catastrophic but not unheard of occurrence. Good backups will turn a potentially disastrous situation into regrettable downtime, but if complete backups are not available for restoration, this guide shows how to restore a WHMCS installation from backups of its constituent parts.
+
Data loss is a catastrophic, but not unheard of occurrence. This is often mitigated by good backup practices which can turn a potentially disastrous situation into manageable downtime.
 
+
The WHMCS is comprised of two main parts; the MySQL database which contains the settings and data, and the files which tell the software how to operate and control its appearance. Provided you have a backup of the database then most data can be salvaged, if you you also have a backup of the configuration.php file then all the data can be recovered.
+
If a complete backup is not available for restoration, then it may be necessary to get WHMCS running again using only a database backup. This guide aims to cover the steps required to restore a WHMCS installation from backups of its constituent parts.
 
+
#The first step is to restore the database backup to your server. Database backups can usually be restored to your hosting account via a web interface such as phpmyadmin. Instructions for doing so are published in our documentation; [[Maintenance#Restoring_a_Database_Backup|Restoring a Database Backup]]
+
== Overview ==
##Your hosting provider will be able to assist in this process if you run into problems.
+
#Next you need to upload a fresh copy of the WHMCS full release files, these can be downloaded from http://download.whmcs.com or from your reseller.
+
WHMCS is effectively comprised of three key parts: the database, the files, and the configuration file; the database contains all of the settings and data used by WHMCS, the files tell the software how to operate and control its appearance, and the configuration file allows the files to communicate with the database.
#Upload the configuration.php file from your file backups.
+
#You should then be up and running with WHMCS once again. Proceed to step 11.
+
Since the database itself contains all of the data, then this means that a WHMCS installation can be restored as long as you have a copy of that database. With that said, restoration can be performed via the following steps:
#If you do not have a backup of the configuration.php file then all password, security questions and credit card data will be scrambled. A new configuration.php file will need to be created using the template at the bottom of this guide.
+
#The license value should be filled with your full licence key.
+
# Restore the Database Backup
#The database connection details (username, password and name) should be entered
+
# Replace the WHMCS Files
##Your hosting provider will be able to advise the values if you're unsure.
+
# Replace or Creating the Configuration File
#The cc_encryption_hash value should be a random 50 character string comprising lowercase letters and numbers.
+
# Perform Post Restoration Steps
#Save and upload the configuration.php file.
+
#You should then be up and running once again with most of your data in tact.
+
It is recommended that all of these steps be reviewed in full before attempting to recover an installation.
#Finally it will be necessary to re-create the [[Crons|cron job(s)]] and [[Email_Piping|email forwarders]].
+
 
+
== Restore the Database Backup ==
==Sample Configuration.php File==
+
 +
The first step towards recovering from catastrophic data loss is to restore the database backup to your server.
 +
 +
Database backups can usually be restored to your hosting account via a web interface such as PHPMyAdmin. For instructions on how to restore a database backup using PHPMyAdmin specifically, please refer to the [[Maintenance#Restoring_a_Database_Backup|Restoring a Database Backup]] section of the documentation.
 +
 +
Should you run into problems while restoring your database backup, then your hosting provider will be able to assist in this process.
 +
 +
== Replace the WHMCS Files ==
 +
 +
With the database restored, the next step is to replace any missing WHMCS files. This can be done by first downloading a fresh copy of the WHMCS full release files.
 +
 +
* If your license was purchased through WHMCS, these can be acquired via the [https://download.whmcs.com/ Download WHMCS] page
 +
* If your license was purchased elsewhere, then a download can be provided by your reseller
 +
 +
Once you acquired a copy of a full release archive, you'll then want to unzip the contents of the file to a folder on your computer, and upload the contents from the "whmcs" directory to your existing installation folder.
 +
 +
== Replace or Creating the Configuration File ==
 +
 +
There are two types of data stored in the WHMCS database: unencrypted and encrypted data.
 +
 +
* Most of the data in WHMCS is not sensitive in nature, and is unencrypted. This consists of things like configuration settings, client details, and orders.
 +
* Some of the data in WHMCS is sensitive in nature, and is encrypted. This consists of items such as credit card details, passwords, and security questions.
 +
 +
If you have a database backup, then all of the unencrypted data is salvageable. If you also happen to have a backup of your configuration file, also known as the configuration.php file, then all of the encrypted data can be recovered as well.
 +
 +
=== Restoring an Existing Configuration File ===
 +
 +
Should you have a backup of your configuration.php file, then you will want to upload that file to your installation directory. At this point you should be up and running with WHMCS once again, and can proceed onto the [[Restoring_WHMCS#Perform_Post_Restoration_Steps|Perform Post Restoration Steps]] section.
 +
 +
=== Creating a New Configuration File ===
 +
 +
Should you not have a backup of the configuration.php file then all password, security questions, and credit card data will be permanently encrypted and unsalvageable.
 +
 +
In this instance, a new configuration.php file will need to be created from scratch using the template found in the [[Restoring_WHMCS#Configuration_File_Template|Configuration File Template]] section of this guide.
 +
 +
* The '''license''' value should be the full licence key
 +
* The '''db_host''' value should be the database hostname
 +
* The '''db_username''' value should be the database username
 +
* The '''db_password''' value should be the database password
 +
* The '''db_name''' value should be the database name
 +
* The '''cc_encryption_hash''' value should be a random 50 character string consisting of numbers and letters of varying cases
 +
 +
If you are uncertain of the correct database connection details (db_host, db_username, db_password, and db_name), then your hosting provider will be able to advise which values should be used.
 +
 +
Once the configuration.php file has been saved and uploaded to your installation directory, you should then be up and running once again with most of your data in tact.
 +
 +
=== Configuration File Template ===
 
<source lang="php">
 
<source lang="php">
 
<?php
 
<?php
Line 27: Line 73:
 
$cc_encryption_hash = "";
 
$cc_encryption_hash = "";
 
$templates_compiledir = "templates_c/";
 
$templates_compiledir = "templates_c/";
?>
 
 
</source>
 
</source>
 +
 +
== Perform Post Restoration Steps ==
 +
 +
After restoring a WHMCS installation, it is a good idea to review all configuration sections of the Admin Area and to place a few test orders to ensure that everything is functioning as expected. Below is a short list of steps to take which will address this.
 +
 +
# Log into the WHMCS Admin Area, and reset your Administrator User password as needed
 +
# Review the [[Configuration|General Settings]]
 +
# Review the configuration of any existing [[Payment_Gateways|Gateway Modules]]
 +
# Review the configuration of any existing [[Servers|Server Modules]]
 +
# Review the configuration of any existing [[Domains_Configuration#Registrar_Configuration|Registar Modules]]
 +
# Recreate any needed [[Cron Jobs|Cron Jobs]] and [[Email_Piping|Email Forwarders]]
 +
# Place some test orders on your website to check everything works as expected

Revision as of 13:49, 25 September 2018

Data loss is a catastrophic, but not unheard of occurrence. This is often mitigated by good backup practices which can turn a potentially disastrous situation into manageable downtime.

If a complete backup is not available for restoration, then it may be necessary to get WHMCS running again using only a database backup. This guide aims to cover the steps required to restore a WHMCS installation from backups of its constituent parts.

Overview

WHMCS is effectively comprised of three key parts: the database, the files, and the configuration file; the database contains all of the settings and data used by WHMCS, the files tell the software how to operate and control its appearance, and the configuration file allows the files to communicate with the database.

Since the database itself contains all of the data, then this means that a WHMCS installation can be restored as long as you have a copy of that database. With that said, restoration can be performed via the following steps:

  1. Restore the Database Backup
  2. Replace the WHMCS Files
  3. Replace or Creating the Configuration File
  4. Perform Post Restoration Steps

It is recommended that all of these steps be reviewed in full before attempting to recover an installation.

Restore the Database Backup

The first step towards recovering from catastrophic data loss is to restore the database backup to your server.

Database backups can usually be restored to your hosting account via a web interface such as PHPMyAdmin. For instructions on how to restore a database backup using PHPMyAdmin specifically, please refer to the Restoring a Database Backup section of the documentation.

Should you run into problems while restoring your database backup, then your hosting provider will be able to assist in this process.

Replace the WHMCS Files

With the database restored, the next step is to replace any missing WHMCS files. This can be done by first downloading a fresh copy of the WHMCS full release files.

  • If your license was purchased through WHMCS, these can be acquired via the Download WHMCS page
  • If your license was purchased elsewhere, then a download can be provided by your reseller

Once you acquired a copy of a full release archive, you'll then want to unzip the contents of the file to a folder on your computer, and upload the contents from the "whmcs" directory to your existing installation folder.

Replace or Creating the Configuration File

There are two types of data stored in the WHMCS database: unencrypted and encrypted data.

  • Most of the data in WHMCS is not sensitive in nature, and is unencrypted. This consists of things like configuration settings, client details, and orders.
  • Some of the data in WHMCS is sensitive in nature, and is encrypted. This consists of items such as credit card details, passwords, and security questions.

If you have a database backup, then all of the unencrypted data is salvageable. If you also happen to have a backup of your configuration file, also known as the configuration.php file, then all of the encrypted data can be recovered as well.

Restoring an Existing Configuration File

Should you have a backup of your configuration.php file, then you will want to upload that file to your installation directory. At this point you should be up and running with WHMCS once again, and can proceed onto the Perform Post Restoration Steps section.

Creating a New Configuration File

Should you not have a backup of the configuration.php file then all password, security questions, and credit card data will be permanently encrypted and unsalvageable.

In this instance, a new configuration.php file will need to be created from scratch using the template found in the Configuration File Template section of this guide.

  • The license value should be the full licence key
  • The db_host value should be the database hostname
  • The db_username value should be the database username
  • The db_password value should be the database password
  • The db_name value should be the database name
  • The cc_encryption_hash value should be a random 50 character string consisting of numbers and letters of varying cases

If you are uncertain of the correct database connection details (db_host, db_username, db_password, and db_name), then your hosting provider will be able to advise which values should be used.

Once the configuration.php file has been saved and uploaded to your installation directory, you should then be up and running once again with most of your data in tact.

Configuration File Template

<?php
$license="";
$db_host = "localhost";
$db_username = "";
$db_password = "";
$db_name = "";
$cc_encryption_hash = "";
$templates_compiledir = "templates_c/";

Perform Post Restoration Steps

After restoring a WHMCS installation, it is a good idea to review all configuration sections of the Admin Area and to place a few test orders to ensure that everything is functioning as expected. Below is a short list of steps to take which will address this.

  1. Log into the WHMCS Admin Area, and reset your Administrator User password as needed
  2. Review the General Settings
  3. Review the configuration of any existing Gateway Modules
  4. Review the configuration of any existing Server Modules
  5. Review the configuration of any existing Registar Modules
  6. Recreate any needed Cron Jobs and Email Forwarders
  7. Place some test orders on your website to check everything works as expected