cPanel-php-remote-backup is a simple php script that allows to make remote backups from a remote cPanel account to a ftp or scp server.
Default cPanel full backup feature does not allow to schedule backups. To generate a backup and transfer to a remote ftp/scp server, you need generate it manually from your cPanel account.
This script aims to schedule full backup generation and ftp/scp transfer using cron and the cPanel xmlapi-php PHP Class
- PHP 5.3.2+
- Composer
- cPanel version 11+
Download or clone the project.
Run composer to install dependencies.
composer install
- Rename or copy example.settings.php to settings.php.
- Edit the new settings.php file and fill the cPanel and remote ftp server settings.
- Test configuration and backup generation:
php cpanel-remote-ftp-backup.php
- If everything goes ok, the script will end without any message, otherwise you will receive an error.
- Schedule script execution to the cron table.
cPanel full backups are not rocket science and you should not rely on them, specially if you are using cheap shared hosting plans.
- At the moment this README was made, the cPanel xmlapi-php PHP Class releases are too old. Since xmlapi-php does not provide a composer.json, this project composer configuration will fetch last commit from dev-master branch and register xmlapi.php Class for auto loading. If you find any problem regarding to the xmlapi-php Class, please open an issue or try to use an older version. The cPanel xmlapi-php PHP Class commit used was b9593c7, from 18 Jan 2015.
- The cPanel xmlapi-php PHP Class uses the deprecated cPanel API 1. However, no equivalent backup function exists in newer APIs.
- Some common problems:
- xmlapi-php Class returns success but the backup is not transferred to ftp server.
- It's most likely that the generation process got stuck on cPanel.
- xmlapi-php Class returns "Can't call method "login" on an undefined value" message.
- It's most likely that the ftp transfer has been blocked. Some hosting providers only allow ftp backup transfers at a certain period of the day.
- In this cases try to manually run the backup generation/transfer on cPanel interface.
- If you get the same error, try to contact to hosting provider.
- If you are able to generate and transfer backup via cPanel and it fails with cPanel-php-remote-backup script, please open an issue for support.
- xmlapi-php Class returns success but the backup is not transferred to ftp server.
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.