Restoring WHMCS
(Redirected from Maintenance)
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.
Contents
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:
- Restore the database backup.
- Replace the WHMCS files.
- Replace or create the configuration file.
- 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:
- Log in to phpMyAdmin and select the database you want to restore.
- Select all tables by clicking Check all.
- Choose Drop for With Selected.
- Go to the Import tab:
- Click Browse.
- Find your backup file and press OK.
- Click Go.
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:
- Log in to the WHMCS Admin Area.
- If necessary, reset your admin password.
- 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.
- Place some test orders on your website.