Here’s the full tutorial on creating automated cPanel backups. Use this form to generate a PHP backup script that creates a cPanel backup.

If you’d like the raw code instead of filling out the form below, visit the Github repo.

To enable automatic uploads of backups to an FTP server, fill out the FTP form fields. If you wish to disable the remote FTP upload feature, simply leave the FTP server field blank and your backups will be saved in your home directory on the cPanel server (the default location).

Your cPanel URL (?):
cPanel username:
cPanel password:
 
FTP Server:
FTP Username:
FTP Password:
FTP Port:
FTP Directory:

Result:

The source code for this script generator can be found on my Github. The PHP code is an upgraded/updated version of this original script from 2006.

63 Comments
Inline Feedbacks
View all comments
Michelle W
4 years ago

Is there any chance you’d considering updating this script to include remote upload to Amazon S3?

Wolvy
6 years ago

This script doesnt support 2FA and therefore should be reconfigured to use a token API instead.

Nate D
5 years ago
Reply to  Wolvy

Any idea how to do that? Please email me if so… Just found out our backups aren’t working!

Vinny
6 years ago

Can someone help out with a script that includes cpsess########## ? The current script generator doesn’t support cpsess and will receive an error.

Samy
6 years ago
Reply to  Vinny

I think you should add that here ( $url = $domain . “/cpsess##########/frontend/” )

Tim
6 years ago

This doesn’t work for me. WHM version 64.
Is there any update?

Lukmanul Hakim
6 years ago

How to set if I want to Email Notification contain just “Full Backup in Progress …” in plain text, not HTML Code of Backup Page on cPanel ?

Steve
6 years ago
Reply to  Lukmanul Hakim

Same problem Eric. Email comes in as HTML code.

Ideally, would be best if it just said ‘Your backup was completed at [time/date] and is stored [here].

Do you have any instruction on how to modify the PHP script for this?

adel
7 years ago

what this problem?

Warning: file_get_contents(http://gtabazan.com:2082/frontend/paper_lantern/backup/dofullbackup.html): failed to open stream: HTTP request failed! HTTP/1.0 401 Access Denied in /home3/gtabazan/public_html/backup/cpanel_backups.php on line 43
Error backing up server.

Maryusss
7 years ago

Eroarea mea:

Warning: file_get_contents(http/frontend/https:///backup/dofullbackup.html): failed to open stream: No such file or directory in /home/zone4metin/backup.php on line 43
Error backing up server.

WHY? ?!

David
7 years ago

Hi Eric, Thank you for this great article.
I would like to save the backup file on the local server (under /backup/cpbackup ”
and not to use FTP … what do I need to do ?

thanks in advanced !