Database Backups
Regular backups help to protect your customer data and WHMCS configuration, and they are vital if you run into certain problems. WHMCS can automatically back up your database and upload it to a SFTP/FTP location or email it to a designated email address. You can also request a full cPanel backup for a specific user as part of the automatic backup process.
You can access this feature at Configuration () > System Settings > Database Backups.
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.
Automated Database Backup
WHMCS can automatically back up your database and upload it to a SFTP/FTP location or email it to a designated email address. We recommend using this method to back up your database regularly.
Backup Options
When you enable automated backups, you can choose from the following backup options:
- SFTP/FTP Backup — Back up your data to an FTP or SFTP location. The system will store the WHMCS-generated zipped SQL file on the specified remote server.This option only supports FTP and SFTP. It does not support other protocols like FTPS and FTP/TLD.
- cPanel Backups — Back up your data using the cPanel API functions for the cPanel Backup Wizard feature. When you enable this backup option, you must create a cPanel API token in WHM at Development » Manage API Tokens with the
basic-system-info
andcpanel-api
permissions.When you select this backup type, the system cron only requests that the system starts a full backup using cPanel’s Backup Wizard feature. It will not detect completion, move the backup file, or provide notification. - Daily Email Backups — Back up your data and email the generated backup file to the specified email address.This method may fail for large databases due to system memory or time execution limits. We do not recommend it for large installations.
Enable Automated Backups
To enable automatic backups:
- Go to Configuration () > System Settings > Database Backups.
- Click on the desired backup option (see above).
- Enter the necessary information for the selected option:
- For SFTP/FTP Backup, enter the hostname, port, username, password, and destination.
- Enter the FTP destination relative to the login folder for the FTP or SFTP account that you are using. For example, if the folder when you log in is at
/home/user
and the backup should exist in/home/user/backups
, enterbackups/
. If you intend to upload the backup file directly within the login folder, leave this value blank. - Check Use Secure FTP/SFTP (Recommended) to ensure that the backup upload uses an SFTP connection.
- Check FTP Passive Mode to use passive mode.
- Enter the FTP destination relative to the login folder for the FTP or SFTP account that you are using. For example, if the folder when you log in is at
- For cPanel Backups, enter the hostname, username, and password for the cPanel account that hosts your WHMCS installation. You can select from the following backup destinations:
- Remote FTP Server — Use FTP to store the backup file on a remote server.
- Remote FTP Server (Passive connection) — Use passive FTP to store the backup file on a remote server.
- Secure Copy (SCP) — Use SCP to store the backup file on a remote server.
- Home Directory — Save the backup file to the server. This option generates the backup file in the cPanel account’s home directory, which the system will include in any disk space limits. We recommend moving this backup manually to another location.
- For Daily Email Backups, enter the email address to receive backups.
- For SFTP/FTP Backup, enter the hostname, port, username, password, and destination.
- If you selected SFTP/FTP Backup or cPanel Backup, click Test Connection to perform a connection test. These backup options require a successful connection test to ensure that details are valid and that WHMCS can connect to the server.
- Click Save & Activate.
Disable Automatic Backups
To disable an automatic backup method, click Deactivate for it at Configuration () > System Settings > Database Backups.
Manual Database Backup
The system cron can perform a backup as one of its tasks. By default, it performs this task once per day.
You can manually download a backup of the WHMCS database at Utilities > System > Database Status.
You can execute the backup task manually by running the following command:
php -q cron.php do --DatabaseBackup
The configuration.php File
Make certain that you are backing up the configuration.php
file in the main whmcs
directory. This file contains the encryption hash value that is unique to your particular installation, which encrypts sensitive data.
Because of this, it is important to keep a backup of this file in a secure location in case reinstallation is necessary.
Troubleshooting
You may encounter the following common issues while performing database backups:
Error or Issue | Cause | Next Steps |
(S)FTP Backup - Uploading Failed | The connection to the FTP server succeeded but the system could not navigate to the destination directory or did not have write permissions. | (S)FTP Backup Upload Errors |
(S)FTP: Unable to open for writing | WHMCS cannot open a test file in the PHP system directory. | (S)FTP Unable to Open Errors |
(S)FTP: Unable to write to temp file | WHMCS cannot write to a test file in the PHP system directory. | (S)FTP Unable to Write Errors |
Database backups fail or time out. | The WHMCS installation’s large database size is preventing PHP from processing the backup. This is one of the most common reason for database backup failures. | Large Database Backup Failures |
Database backup unavailable due to missing required zip extension | The ZipArchive PHP class is missing from your PHP configuration. | Missing Zip Extension Errors |
SFTP Backup - Login Failed | The system reached the FTP server but it rejected the login details. | SFTP Backup Login Errors |
Table 'xxx' doesn't exist when using LOCK TABLES | The named table (xxx ) has crashed or is corrupted. | Table Doesn't Exist Errors |
Database backup error 'Please provide a valid dump path' | WHMCS cannot access the /tmp working directory during the backup generation process. | Valid Dump Path Errors |
Last modified: 2025 March 28