Difference between revisions of "Restoring WHMCS"

From WHMCS Documentation

 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
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.
+
Data loss is a catastrophic but not unheard-of occurrence. Good backup practices can mitigate the risks and 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.
+
If a complete backup is not available for restoration, you may need to restore with a database backup using the steps below.
 +
 
 +
== Data in WHMCS ==
 
   
 
   
== Overview ==
+
WHMCS is effectively comprised of three key parts:
+
 
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.
+
* The '''database''' contains all of the settings and data that WHMCS uses.
 +
* The '''files''' tell the software how to operate and control its appearance.
 +
* 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:
+
Because the database itself contains all of the data, you can restore a WHMCS installation as long as you have a copy of that database. This uses the following process:
 
   
 
   
# Restore the Database Backup
+
# [[#Restore the Database Backup|Restore the database backup.]]
# Replace the WHMCS Files
+
# [[#Replace the WHMCS Files|Replace the WHMCS files.]]
# Replace or Creating the Configuration File
+
# [[#Replace or Creating the Configuration File|Replace or create the configuration file.]]
# Perform Post Restoration Steps
+
# [[#Perform Post Restoration Steps|Perform post-restoration steps.]]
 
   
 
   
It is recommended that all of these steps be reviewed in full before attempting to recover an installation.
+
We recommend that you review all of the steps in this process (below) before you attempt to perform it on your WHMCS installation.
 
   
 
   
 
== Restore the Database Backup ==
 
== Restore the Database Backup ==
Line 20: Line 24:
 
The first step towards recovering from catastrophic data loss is to restore the database backup to your server.
 
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. Should you run into problems while restoring your database backup, then your hosting provider will be able to assist in this process.
+
You can usually restore database backups to your hosting account via a web interface like phpMyAdmin. For help with this process, contact your hosting provider or system administrator.
  
 
To restore a database:  
 
To restore a database:  
  
 
#Log in to phpMyAdmin and select the database you want to restore.
 
#Log in to phpMyAdmin and select the database you want to restore.
#Select all tables using the ''Check all'' option.
+
#Select all tables by clicking '''Check all'''.
#Choose the ''Drop'' option from the '''With Selected''' menu.<br /><br />[[Image:Drop-tables.png|800px]] <br /><br />
+
#Choose ''Drop'' for '''With Selected'''.<br /><br />[[Image:Drop-tables.png|800px]] <br /><br />
#Click the '''Import''' tab at the top: <br /><br />[[Image:maintenance1.png]] <br /><br />
+
#Go to the '''Import''' tab: <br /><br />[[Image:maintenance1.png]] <br /><br />
#Click the '''Browse''' button.
+
#Click '''Browse'''.
#Find your backup file and then press '''OK'''.
+
#Find your backup file and press '''OK'''.
 
#Click '''Go'''. <br /><br />[[Image:maintenance2.png]]
 
#Click '''Go'''. <br /><br />[[Image:maintenance2.png]]
  
 
== Replace the WHMCS Files ==
 
== 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.
+
Next, you must replace any missing WHMCS files. You can do this by downloading a new 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 you purchased your license through WHMCS, download these from [https://download.whmcs.com/ Download WHMCS].
* If your license was purchased elsewhere, then a download can be provided by your reseller
+
* If you purchased your license elsewhere, request a new copy from 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.
+
Unzip the contents of the file to a folder on your computer and upload the contents from the <tt>whmcs</tt> directory to your existing installation folder.
 
   
 
   
 
== Replace or Creating the Configuration File ==
 
== Replace or Creating the Configuration File ==
 
   
 
   
There are two types of data stored in the WHMCS database: unencrypted and encrypted data.
+
The WHMCS database stores encrypted and unencrypted 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.
+
* Data that is not sensitive is unencrypted (for example, 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.
+
* Sensitive data is encrypted (for example, 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.
+
If you have a database backup, you can salvage all of the unencrypted data. You will need a backup of your configuration file (<tt>configuration.php</tt>) to recover the encrypted data.
 
   
 
   
 
=== Restoring an Existing Configuration File ===
 
=== 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.
+
If you have a backup of your <tt>configuration.php</tt> file, upload it to your installation directory.  
 +
 
 +
You can then proceed to [[Restoring_WHMCS#Perform_Post_Restoration_Steps|performing the post-restoration steps]].
 
   
 
   
 
=== Creating a New Configuration File ===
 
=== 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.
+
If you do not have a backup of the <tt>configuration.php</tt> file, then all password, security questions, and credit card data will remain permanently encrypted and you will not be able to salvage it.
 
   
 
   
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.
+
In this situation, you must create a new <tt>configuration.php</tt> file using the [[Restoring_WHMCS#Configuration_File_Template|Configuration File Template]].
 
   
 
   
* The '''license''' value should be the full licence key
+
* The '''license''' value should be the full licence key.
* The '''db_host''' value should be the database hostname
+
* The '''db_host''' value should be the database hostname.
* The '''db_username''' value should be the database username
+
* The '''db_username''' value should be the database username.
* The '''db_password''' value should be the database password
+
* The '''db_password''' value should be the database password.
* The '''db_name''' value should be the database name
+
* 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
+
* 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.
+
If you are uncertain of the correct database connection details (<tt>db_host</tt>, <tt>db_username</tt>, <tt>db_password</tt>, and <tt>db_name</tt>), 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.
+
After you save the <tt>configuration.php</tt> file and upload it to your installation directory, your WHMCS installation should run with intact data.
 
   
 
   
 
=== Configuration File Template ===
 
=== Configuration File Template ===
Line 85: Line 91:
 
== Perform Post Restoration Steps ==
 
== 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.
+
After restoring a WHMCS installation, make sure to review all configuration sections in the [[Admin Area]] and place a few test orders. We recommend the following steps:
 
   
 
   
# Log into the WHMCS Admin Area, and reset your Administrator User password as needed
+
# Log in to the WHMCS Admin Area.
# Review the [[Configuration|General Settings]]
+
# If necessary, reset your admin password.
# Review the configuration of any existing [[Payment_Gateways|Gateway Modules]]
+
# Review the following settings and configurations:
# Review the configuration of any existing [[Servers|Server Modules]]
+
#* Configuration settings at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[General Settings]]''' or, prior to WHMCS 8.0, '''Setup > General Settings'''.
# Review the configuration of any existing [[Domains_Configuration#Registrar_Configuration|Registar Modules]]
+
#* Payment gateways at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Payment Gateways]]''' or, prior to WHMCS 8.0, '''Setup  > Payment Gateways'''.
# Recreate any needed [[Cron Jobs|Cron Jobs]] and [[Email_Piping|Email Forwarders]]
+
#* Servers at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Servers]]''' or, prior to WHMCS 8.0, '''Setup  > Products/Services > Servers'''.
# Place some test orders on your website to check everything works as expected
+
#* Domain registrars at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Domain Registrars]]''' or, prior to WHMCS 8.0, '''Setup  > Products/Services > Domain Registrars'''.
 +
#* Any [[Cron Jobs|cron jobs]] or [[Email Piping|email forwarders]].
 +
# Place some test orders on your website.

Latest revision as of 18:47, 3 May 2022

Data loss is a catastrophic but not unheard-of occurrence. Good backup practices can mitigate the risks and turn a potentially-disastrous situation into manageable downtime.

If a complete backup is not available for restoration, you may need to restore with a database backup using the steps below.

Data in WHMCS

WHMCS is effectively comprised of three key parts:

  • The database contains all of the settings and data that WHMCS uses.
  • The files tell the software how to operate and control its appearance.
  • The configuration file allows the files to communicate with the database.

Because the database itself contains all of the data, you can restore a WHMCS installation as long as you have a copy of that database. This uses the following process:

  1. Restore the database backup.
  2. Replace the WHMCS files.
  3. Replace or create the configuration file.
  4. Perform post-restoration steps.

We recommend that you review all of the steps in this process (below) before you attempt to perform it on your WHMCS installation.

Restore the Database Backup

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

You can usually restore database backups to your hosting account via a web interface like phpMyAdmin. For help with this process, contact your hosting provider or system administrator.

To restore a database:

  1. Log in to phpMyAdmin and select the database you want to restore.
  2. Select all tables by clicking Check all.
  3. Choose Drop for With Selected.

    Drop-tables.png

  4. Go to the Import tab:

    Maintenance1.png

  5. Click Browse.
  6. Find your backup file and press OK.
  7. Click Go.

    Maintenance2.png

Replace the WHMCS Files

Next, you must replace any missing WHMCS files. You can do this by downloading a new copy of the WHMCS full release files.

  • If you purchased your license through WHMCS, download these from Download WHMCS.
  • If you purchased your license elsewhere, request a new copy from your reseller.

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

The WHMCS database stores encrypted and unencrypted data.

  • Data that is not sensitive is unencrypted (for example, configuration settings, client details, and orders).
  • Sensitive data is encrypted (for example, credit card details, passwords, and security questions).

If you have a database backup, you can salvage all of the unencrypted data. You will need a backup of your configuration file (configuration.php) to recover the encrypted data.

Restoring an Existing Configuration File

If you have a backup of your configuration.php file, upload it to your installation directory.

You can then proceed to performing the post-restoration steps.

Creating a New Configuration File

If you do not have a backup of the configuration.php file, then all password, security questions, and credit card data will remain permanently encrypted and you will not be able to salvage it.

In this situation, you must create a new configuration.php file using the Configuration File Template.

  • 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.

After you save the configuration.php file and upload it to your installation directory, your WHMCS installation should run with intact data.

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, make sure to review all configuration sections in the Admin Area and place a few test orders. We recommend the following steps:

  1. Log in to the WHMCS Admin Area.
  2. If necessary, reset your admin password.
  3. Review the following settings and configurations:
    • Configuration settings at Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings.
    • Payment gateways at Configuration () > System Settings > Payment Gateways or, prior to WHMCS 8.0, Setup > Payment Gateways.
    • Servers at Configuration () > System Settings > Servers or, prior to WHMCS 8.0, Setup > Products/Services > Servers.
    • Domain registrars at Configuration () > System Settings > Domain Registrars or, prior to WHMCS 8.0, Setup > Products/Services > Domain Registrars.
    • Any cron jobs or email forwarders.
  4. Place some test orders on your website.