Following on from our previous post ( there is another script for the full backup of CPanel web directories.

The original post is taken from which contains a link to download the PHP files.

The main file to worry about is the config.php which contains a cpanel section:

define( ‘CPANEL_SERVER_ADDRESS’, ‘abc.def.ghj.mnp’ ); // IP address or domain name for the server with the cPanel account
define( ‘CPANEL_PORT_NUM’, ‘2083’ ); // The port number for the cPanel. If you have problems, try 2082
define( ‘CPANEL_ADMIN_USERNAME’, ‘admin-username’ ); // the admin username for your cPanel account
define( ‘CPANEL_ADMIN_PASSWORD’, ‘veryStrongPassword’ ); // the admin password for your cPanel account

and the FTP server section:
define( ‘FTP_SERVER_ADDRESS’, ‘’ ); // IP address or URL of the FTP server
define( ‘FTP_SERVER_PORT’, ’21’ ); // FTP(S) Port. Default is 21.
define( ‘FTP_USERNAME’, ‘ftp-username’ ); // FTP Username
define( ‘FTP_PASSWORD’, ‘ftp-password’ ); // FTP Password
define( ‘FTP_PATH_TO_COPY’, ‘/ftp/path/to/copy/’ ); // FTP Path (where do you want to copy the files?)

Simply enter in your CPanel and FTP server account details to this PHP script.

Once in place setup the cron job to run on a regular basis e.g.

1 1 * * * php -q /home/user/path_to_phpscript/cpanelbackup.php

Written by Matt Cooper
Hi, I'm Matt Cooper. I started this blog to pretty much act as a brain dump area for things I learn from day to day. You can contact me at: