Database Backups

From WHMCS Documentation

Revision as of 14:35, 18 October 2023 by Lawrence (talk | contribs) (cPanel Backup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Regular backups help to protect your customer data and WHMCS configuration, and they are vital if you run into certain prolems. 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.

We added automated backups in WHMCS 7.3.

Enable Automatic Backups

To enable automatic backups for your WHMCS installation:

  1. Choose a backup option by clicking the correct heading: SFTP/FTP Backup, cPanel Backup, or Daily Email Backups.
    Connection Tests
    The SFTP/FTP Backup and cPanel Backup options require a successful connection test before activation. A connection test ensures that the details are valid and the WHMCS installation can connect to the server. Any connection issue allows a resolution before a backup attempt occurs, incurring less chance of a failed connection.
  2. Enter the necessary informaton for that option. For more information on each option, see the sections below.
  3. Click Test Connection or Save & Activate.

SFTP/FTP Backup

The SFTP/FTP Backup option only supports FTP and SFTP. Other protocols, like FTPS and FTP/TLD, are unsupported.

This backup type stores the WHMCS-generated zipped SQL file on the specified remote server. Check "'Use Secure FTP/SFTP (Recommended)'" to ensure that the backup upload is completed using an SFTP connection.

FTP Destination

The FTP Destination value is relative to the login folder for the FTP/SFTP account you are using. For example, if, when you log in using your FTP details, the folder is /home/user/ and the backup will be in /home/user/backups, enter backups/ as the FTP Destination value.

If you intend to upload the backup file to the login folder, leave this field empty.

cPanel Backup

The cPanel Backup option uses the backup API functions that cPanel & WHM provides to generate backups using an API token.

API tokens in cPanel & WHM allow you to restrict the actions that an API token can perform. To do this, you must create a token with the following permissions in WHM at Development >> Manage API Tokens:

basic-whm-functions cpanel-api

cPanel Username

When you enter your cPanel account information, the cPanel Username value is the name of the account that hosts your WHMCS installation.

Backup Destination

You can select the following Backup Destination options:

  • Remote FTP Server — Select this option to use FTP to store the backup file on a remote server.
  • Remote FTP Server (Passive connection) — Select this option to use passive FTP to store the backup file on a remote server.
  • Secure Copy (SCP) — Select this option to use SCP to store the backup file on a remote server.
  • Home Directory — Select this option to save the backup file to the server.
Using Home Directory will generate the backup file in the cPanel user's home directory. This will count against any disk space limits, and you should manually move it to a better location after completion.

The system cron job will only request the start of a full backup. Completion and relocation of the backup occurs within cPanel, and WHMCS will not notify you about the process.

Daily Email Backups

This backup option may fail to complete successfully with large databases due to system memory or time execution limits. We do not recommend this method for larger installations.

Disable Automatic Backups

To disable an automatic backup method:

  1. Click on that option.
  2. Click Deactivate.