Difference between revisions of "Backups"
(→Optimise Tables) |
m (→SFTP/FTP Backup) |
||
Line 18: | Line 18: | ||
==SFTP/FTP Backup== | ==SFTP/FTP Backup== | ||
+ | |||
+ | <div class="docs-alert-info"><i class="fa fa-info"></i>WHMCS offers backups via plain FTP and SFTP. Other protocols, such as FTPS and FTP/TLS, are not supported.</div> | ||
This backup will place the WHMCS-generated zipped SQL file on the specified remote server. | This backup will place the WHMCS-generated zipped SQL file on the specified remote server. |
Revision as of 15:53, 2 June 2020
We strongly recommend that you back up your WHMCS database regularly, so that you always have a copy of your data if a server or system failure occurs. Backing up the database is a very simply task with the built-in backup tool, and you can automate it.
Contents
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. Starting in WHMCS 7.3, you can also request a full cPanel backup for a specific user as part of the automatic backup process.
Enabling Automatic Backups
To modify your backup configuration, go to Setup > Other > Database Backups.
The available options are SFTP/FTP Backup, cPanel Backup, and Daily Email Backups.
Testing Connection
The SFTP/FTP Backup and cPanel Backup options require a successful connection test before activation. A connection test ensures 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.
SFTP/FTP Backup
This backup will place the WHMCS-generated zipped SQL file on the specified remote server.
Checking the "'Use Secure FTP/SFTP (Recommended)'" box will ensure the backup upload is completed using an SFTP connection.
FTP Destination
This 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.
If you intend to upload the backup file to the login folder, leave this field empty.
cPanel Backup
The cPanel Backup option uses the Full Backup feature of cPanel's backup wizard.
cPanel Username
Backup Destination
- 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.
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.
Manual Database Backup
To manually download a backup of the WHMCS database at any time:
- Log in to your WHMCS Admin Area.
- Go to Utilities > System > Database Status.
- Click the Download Database Backup button at the top of the page. The system will prompt you to download a file.
- Save the file to your computer. Depending on the database size, this may take a few moments.
Configuration.php Backup
The configuration.php file in the main whmcs directory. It contains the encryption hash value unique to your particular installation, which encrypts sensitive data. If you lose the encryption hash value, the system won't be able to decrypt your data. Because of this, it is important to keep a backup of this file in a secure location in case reinstallation is necessary.
Limitations
As a database grows, it becomes too big for a PHP script like the WHMCS cron job to handle, due to the amount of data in it exceeding various server limits, usually when the database exceeds 20 MB. The size prevents the system from completing an FTP or Email backup.
In this case, we recommend switching to the cPanel Backup option instead (if you installed WHMCS on a cPanel server). By off-loading the backup tasks from PHP to the cPanel system processes, it allows you to generate much larger backups without impacting performance of your website.
Optimise Tables
In normal operation, MySQL® tables can generate overhead. This is disk space that you have assigned to the table but aren't using. You can use MySQL's optimize tables function to reduce this. Usually this command is from the server's command line or phpMyAdmin, but it can also be run within WHMCS by clicking Optimise Tables at Utilities > System > Database Status.
Troubleshooting
A number of errors may occur onscreen when you generate a manual database backup, or in the Utilities > Logs > Activity Log when generating an automated database backup:
Table 'xxx' doesn't exist when using LOCK TABLES
This indicates that the named table xxx has crashed or is corrupted. Running a MySQL repair operation will resolve this. You can repair tables via the MySQL Databases page within cPanel or using a tool such as phpMyAdmin.
This indicates that you need to recompile PHP after enabling the ZipArchive PHP class, which WHMCS requires to compress the backup.
Database backup error 'Please provide a valid dump path'
This indicates that WHMCS is unable to access the /tmp working directory during the backup generation process. Make sure that the open_basedir value is Off in your PHP configuration, and that the PHP /tmp directory is writeable and is not full.