Difference between revisions of "Backups"

From WHMCS Documentation

(Troubleshooting)
m (Automated Database Backup)
Line 11: Line 11:
  
 
==Automated Database Backup==
 
==Automated Database Backup==
WHMCS can automatically email a database backup to a designated email address or upload it to a remote location via FTP on a daily basis as part of the automation cron:
+
<div class="docs-alert-info"><i class="fa fa-info"></i> New functionality for backups has been introduced in WHMCS 7.3 - See [[Automatic Backups]]</div>
 
 
#Login to your WHMCS Admin Area
 
#Go to''' Setup > Other > Database Backups'''
 
#To use the email backup facility simply enter an email address is the '''Daily Email Backups''' section.
 
#To use the remote FTP backup facility enter the FTP connection details in the '''Daily Remote FTP Backup''' section. In the 'FTP Destination' field enter the path relative to the login folder where you'd like the backups uploaded, this location must exist as WHMCS cannot create the directories itself.
 
For example, if upon logging in using those FTP details you're in /home/user/ and you wanted to backup in /home/user/backups, then you'd enter backups/ as the FTP Destination.
 
  
 
==Configuration.php Backup==
 
==Configuration.php Backup==

Revision as of 11:27, 11 August 2017

It is strongly recommended that you backup your WHMCS Database regularly to ensure you always have a copy of your data should a server or system failure occur. Backing up the database is a very simply task with the built in backup tool and can even be fully automated.

Manual Database Backup

To manually download a backup of the WHMCS database at any time:

  1. Login to your WHMCS Admin Area
  2. Go to Utilities > System > Database Status
  3. Click the Download Full Database Backup button at the top of the page
  4. You should be prompted for a file to download. Save the file to your computer. Depending on the database size, this may take a few moments.
  5. Once the download is complete you have now backed up your database.

Automated Database Backup

New functionality for backups has been introduced in WHMCS 7.3 - See Automatic Backups

Configuration.php Backup

The configuration.php file in the main whmcs directory contains the encryption hash value unique to your particular installation, it's used to encrypt sensitive data so should it be lost this data can no longer be decrypted. Therefore it is important for a backup of this file to be kept in a secure location in case re-installation is necessary.

Limitations

As a DB grows, it becomes too big for a PHP script like the WHMCS cron to handle backing up due to the amount of data within it causing various server limits to be exceeded, usually around the 20MB mark. Unfortunately being big simply means that for a PHP script to loop through and save that data into temporary memory in order to generate a full backup is not possible - either the memory limits or max execution time limits on the server side of things will kick in way before that completes and terminate the script. So the only option at that stage is to look at using an alternative backup means such as WHM automated backups or manual phpMyAdmin exports.

Optimise Tables

In normal operation MySQL tables can generate overhead, put simply this is space assigned to the table that isn't being used but is still taking up disk space. MySQL has a function called optimise tables which can be used to reduce this. Usually this command is from from the server's command line or phpmyadmin, but it can also be run within WHMCS by clicking the Utilities > System > Database Status > Optimise Tables button.

Troubleshooting

A number of errors may occur on-screen when generated a manual database backup, or in the Utilities > Logs > Activity Log when generated an automated database backup. They are explained below:

Table 'xxx' doesn't exist when using LOCK TABLES

Indicates the named table 'xxx' is crashed or corrupted. Running a MySQL repair operation will resolve this. Tables can be repaired via the MySQL Databases page within cPanel or using a tool such as phpmyadmin.

Database backup unavailable due to missing required zip extension

This refers to the ZipArchive PHP class which is required by WHMCS to compress the backup. Please recompile PHP with support for this class: http://php.net/manual/en/class.ziparchive.php

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. Please ensure that the open_basedir value is set to Off in your PHP configuration, that the PHP /tmp directory is writeable and is not full.