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:


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.

Inline Feedbacks
View all comments
9 years ago

I have this code working for GoDaddy paper lantern

8 years ago
Reply to  Brandon

I seem to be running into an issue since migrating my server to PHP 5.6 – the following error occurs:

HTTP/1.1 301 Moved Server: cpsrvd/ Connection: close Content-length: 120 Location: https://(URL):2083/ Content-type: text/html; charset=”utf-8″

Where (URL) is the cPanel URL for my hosted server.

If I revert back to PHP 5.5, the issue is cleared up. Any help on how to update this for 5.6?

Thank you for your help!

9 years ago

Looks like cPanel doesn’t work with the script. I have tried everything to get this to work and its not working properly. I never see the backup get created in the Home Directory and I never see the backup on the FTP site I setup either. I have tried so many different variations of settings but nothing works. I know the script gets kicked off because I get the email but I don’t get any real information from it that tells me why it failed. I know that they recently upgraded their servers to cPanel 11.44.2 and was wondering… Read more »

9 years ago

GoDaddy recently moved to the Paper Lantern theme, which has broken this script. It also appears they have added a security token to the URL which I didn’t notice previously.

Any thoughts on how to fix this?

9 years ago
Reply to  BobT

I have this code working for GoDaddy paper lantern.

9 years ago

How to set up different directories, if i want to back up only a certain folder and put it in a certain folder where should i edit this?

$secure = true;
if i don’t change this to false the backup is only 13kb
what is that setting?

9 years ago

Hi, Thanks for the great script. The FTP account that I used should be in passive mode. What’s the query string is $parameter to enable passive code?


10 years ago

Don’t fill anything…with TRUE credentials…please modify your script after the auto generated file.

Well done..great script !!!!!

10 years ago

I was keen to use this. Unfortunately CPanel on my hosting account has a security token built into the URL. Something like,

I have older Cpanel accounts which do not use this cpsess### token.

Does this mean I won’t be able to use your script?



10 years ago
Reply to  Jonathan

Same issue here. Any solution?

9 years ago
Reply to  Venson

Same issue here again. Any pointers for a solution? This script is exactly what I was looking for.

9 years ago
Reply to  Jonathan

Hi, skip the token part like this:

This will work…

9 years ago
Reply to  Burak

Thanks. Worked fine for me. Thanks for sharing the script and the solution!

[…] to Unblock Mozilla Firefox Browser? Click “Start,” Menu. Click on “Control Panel“. Go to “System Security.” Click the “Allow a Program through Windows […]

1 2 3 6