Automatic cPanel backup (domain & MySQL) with cron & PHP
OK, so I posed the question, and I found the answer. (Of course I had to find it myself, I just don't have people who regularly read my posts and do research for me!)
The situation is this: I use cPanel on my web hosting server. I use the cPanel backup tool to regularly backup my home directory (includes my web files, mail, etc), and my MySQL databases. I love the fact that you can use it to backup to a remote FTP server, and I do that on a fairly regular basis.
The major drawback is that you have to remember/schedule to perform this backup manually. This becomes especially difficult if you have multiple cPanel accounts. It would be amazing if you could just schedule the cPanel backup to run at regular intervals, perhaps with cron. Well, although there's no option for that in cPanel, the script below will allow you to do exactly that!
This backup script includes SSL support. This isn't necessary if you run the script on the server for which you're generating the backup; but the SSL support is very important if you're running the script somewhere else to connect to your cPanel hosting account.
// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
// This script contains passwords. KEEP ACCESS TO THIS FILE SECURE! (place it in your home dir, not /www/)
// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********
// Info required for cPanel access
$cpuser = "username"; // Username used to login to CPanel
$cppass = "password"; // Password used to login to CPanel
$domain = "example.com"; // Domain name where CPanel is run
$skin = "x"; // Set to cPanel skin you use (script won't work if it doesn't match). Most people run the default x theme
// Info required for FTP host
$ftpuser = "ftpusername"; // Username for FTP account
$ftppass = "ftppassword"; // Password for FTP account
$ftphost = "ftp.example.com"; // Full hostname or IP address for FTP host
$ftpmode = "ftp"; // FTP mode ("ftp" for active, "passiveftp" for passive)
// Notification information
$notifyemail = "you@example.com"; // Email address to send results
// Secure or non-secure mode
$secure = 0; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP
// Set to 1 to have web page result appear in your cron log
$debug = 0;
// *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********
if ($secure) {
$url = "ssl://".$domain;
$port = 2083;
} else {
$url = $domain;
$port = 2082;
}
$socket = fsockopen($url,$port);
if (!$socket) { echo "Failed to open socket connection… Bailing out!\n"; exit; }
// Encode authentication string
$authstr = $cpuser.":".$cppass;
$pass = base64_encode($authstr);
$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&submit=Generate Backup";
// Make POST to cPanel
fputs($socket,"POST /frontend/".$skin."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
fputs($socket,"Host: $domain\r\n");
fputs($socket,"Authorization: Basic $pass\r\n");
fputs($socket,"Connection: Close\r\n");
fputs($socket,"\r\n");
// Grab response even if we don't do anything with it.
while (!feof($socket)) {
$response = fgets($socket,4096);
if ($debug) echo $response;
}
fclose($socket);
?>
To schedule the script to run regularly, save it as fullbackup.php in your top directory (not /public_html, which would be less secure), and enter a new cron job like the following:
(Runs every night at 2:15 a.m.)
or
(Runs every Sunday night at 2:15 a.m.)


on February 3rd, 2007 at 4:00 am
Hi. Thanks for posting this script – it was exactly what I was after – I've added it to my server and am using an online file storage service to send the backup to. However, there is one slight problem that I'm hoping you may be able to help with….
The file is not being backed up to the remote server because the remote server uses PassiveFTP. In the e-mail confirmation generated by your script it says:
Failed to create ActiveFTP Data Connection. (Blocked by firewall?) Please use PassiveFTP, or download our file manager software.
Is there anyway I can modify the script to enable, support and use passiveFTP?
on February 3rd, 2007 at 4:04 am
sorry, just spotted the "add passiveftp" for passiveftp line – i'll try that..
on February 10th, 2007 at 12:39 pm
Awesome, just what I was looking for. I haven`t tried it yet. I assume the script when FTPing a backup (tar), it would replace an existing backup file with the same name on the remote host/server?
on February 10th, 2007 at 1:52 pm
That shouldn't be an issue, as the cPanel backup filenames contain the usernme, date and exact time, so they should all be unique
on February 10th, 2007 at 3:11 pm
Actually, I would prefer they simply replace previous backups. I don`t want to see tar files piling up on the remote server and hogging all the space.
I`m getting an error from the script report..
Can't call method "login" on an undefined value at /usr/local/cpanel/bin/ftpput line 28.
Thanks.
on February 10th, 2007 at 3:40 pm
Never mind, I had the wrong ftp domain/ip in the script. Is there anyway that when cpanel has ftp`d the backup to the remote host/server, it removes the previous backup uploaded? I`m just trying to avoid having a bunch of backups taking all the space on the server. I only need one backup, that`s the most recent, not an archive of them. Thanks again.
on February 12th, 2007 at 7:51 am
I don't know, you'd have to script that yourself, add an extra step to delete the file(s).
I wouldn't do that though, in case you need a backup from a week ago. Why not just archive them to DVD or whatever once the drive is getting full?
on February 12th, 2007 at 11:06 am
Is there any way to further configure this script to enable it to upload the backup file to a particular folder on the FTP account?
on February 12th, 2007 at 11:08 am
To do that, I would create a unique FTP user on the FTP server, and make their home directory the backup dir
on February 12th, 2007 at 11:11 am
..and if that isn't possible – like for a file space associated with an e-mail account?
on February 12th, 2007 at 11:26 am
Try this (untested):
below this line: $ftpmode = "ftp";
add: $ftpdir = "/yourdir";
and change this line:
$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&submit=Generate Backup";
to:
$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&rdir=$ftpdir&submit=Generate Backup";
on February 15th, 2007 at 10:58 am
This is the most exciting article I've read all week.. (I've been looking for exactly this for a while now).
Thank you.
on April 11th, 2007 at 5:35 am
I would like to send the backup to my email rather than to an FTP server – is this possible and how can I do this/what modifications do I need to do to the above script?
on April 11th, 2007 at 8:53 am
Sorry, cPanel does not provide that functionality. And that wouldn't be a very reliable means of backup, especially as your website grows in size
on April 11th, 2007 at 9:24 am
Would you be able to suggest a (free?) online file storage service which allows ftp access so i can do this?
Please.
on April 11th, 2007 at 9:27 am
both idrive.com and xdrive.com offer some free storage, but I'm not sure if either provide FTP access yet…
on April 12th, 2007 at 1:05 am
Ok, Ive got the script to work and I found a free FTP online file sharing service but everytime i run the script, it leaves behind in the /home/username/ directory an empty .tar.gz file (supposedly the backup, which has been ftp'd to the other server). Should it be doing that?
on April 12th, 2007 at 7:14 am
Which free ftp service are you using? Is it secure?
And yes, I believe it will always leave an empty .gz file
on April 12th, 2007 at 10:31 am
I'm using FileHo!
And I'm not sure if its secure – I don't think it is – but it does the job well.
on April 26th, 2007 at 11:06 pm
I am trying to run this script in cPanel but I keep getting a Permission Denied error in my email…anyway idea why?
on April 27th, 2007 at 7:12 am
Check with your host, see if your cron privileges are ok
on April 28th, 2007 at 3:15 am
That cron code that you've given, where do we insert it?
I mean, in the basic mode, or the advanced(unix) mode?
on April 28th, 2007 at 7:04 am
It would be in the advanced cron mode
on April 28th, 2007 at 12:25 pm
Thank you, this script worked great.
on May 10th, 2007 at 10:48 am
Great script Justin. Is it possible to pull a backup of the MySQL datase only?
My site rarely changes but the database changes every day. I would like to back them up individually and with different frequency.
Thanks in advance
on May 10th, 2007 at 12:16 pm
No, this script could not be modified for that purpose, because cPanel does not have anything built into it to FTP the databases only
on May 11th, 2007 at 12:32 pm
hi, i execute my script like "php -q /home/eis-software/CronBack.php" and returns "No input file specified" what can i do?
thanks in advance
on May 11th, 2007 at 3:25 pm
Justin,
After looking at the WHM backup configuration, it appears that you can backup the MySQL directory only. Are you sure this script cannot be used for that purpose? Screenshot of WHM backup config.
Regards,
Bill
on May 13th, 2007 at 4:09 pm
This script utilizes the cPanel FTP functionality, which backs up the entire user directory, files, DB, everything. That can't be changed
on May 14th, 2007 at 5:34 am
Hi,
Thanks for this script. I've installed it on my server and it is successfully sending the backup to my remote backup server, however, it keeps leaving an empty zip file in the root of my local server. Any idea why this happening and how I can fix this issue? Thanks again.
Summer
on May 14th, 2007 at 7:03 am
This is the default behaviour of cPanel. Please do not use spammy keyword-laden names in comments, thank you
on June 12th, 2007 at 3:57 pm
I have used this script for a while and it has worked well. Thank You. Lately though I have been getting this error:
Can’t call method “login” on an undefined value at /usr/local/cpanel/bin/ftpput line 28.
Any Ideas?
Thanks
Ron
on June 12th, 2007 at 6:05 pm
sounds like your cpanel web host changed something!
on June 12th, 2007 at 7:44 pm
Thanks – I guess there is not much I can do. It is on a reseller box.
on June 23rd, 2007 at 8:15 pm
Hi Justin,
This looks a nice simple script, much better than the over-complicated offerings that others put out, which all seem to rely on downloading or accepting the zipped file in email, not practical when I have upwards of 50 MB zipped to backup!
If it would work it would be ideal for my domain to run a weekly site back up. The problem is I just ran it via crontab and got back the error that the /frontend/…/dofullbackup.html file does not exist. Were you using the default configuration of a typical cPanel, or is it possible this is set up differently as some preference of the host? Thanks for any help you can offer.
on June 24th, 2007 at 8:33 pm
You should try running the backup through cPanel manually and see what happens. I would recommend that you check with your host though, as this seems like a pretty unique error
on July 10th, 2007 at 3:16 pm
Hi,
nice script, but may I ask for what you use it? I just bought an Server, looked in my CPanel and there under backup are a lot of radio boxes where I can choose to have it backed daily, weekly etc etc…? Or do I think in the wrong direction?
on July 10th, 2007 at 3:20 pm
You don't technically have to login to cPanel, the script does all that for you
on July 10th, 2007 at 3:59 pm
Hmmm sorry I dont get it lol ;o)
In WHM are options so I can specify intervals for the backup to run, so WHM runs an backup every day at 2.15 p.m as example…without me logging in manually…
What is the part I am missing now? ^^
on July 10th, 2007 at 4:05 pm
If you can do it through WHM, you should be fine. However, if you need to do it through cPanel, and to a remote FTP server, then you would use the above script
on July 10th, 2007 at 4:20 pm
Yes true, that was the part were I was thinking in a wrong direction…Thanks
on July 11th, 2007 at 11:14 am
It would like to know if this script functions to make backup of cPanel of the customer for another external server, remembering that the customer who has cPanel does not have access to the SSH of the server of it therefore it is a resale.
on July 11th, 2007 at 11:17 am
Yes, it does that. You don't need to have SSH access.
on July 11th, 2007 at 11:22 am
Independent of the skin of cpanel, it makes backup full of the account?
on July 11th, 2007 at 11:24 am
That's right. You just enter the name of the cPanel skin you're using.
on July 11th, 2007 at 11:25 am
But to program cron it would not be necessary to have access to the Server where is the resale? Or in script it has as to make a programming to generate the schedules of backups?
on July 11th, 2007 at 11:26 am
you only need to have the username/password to access cPanel, even on the resale account. The script and cron job can reside on another server, or on the resale server, it doesn't matter
on July 11th, 2007 at 11:28 am
Beyond this script conheçe some another one or some software.exe that it makes this same function, therefore is approximately 600 accounts to make backups full to each 2 days
on July 11th, 2007 at 11:30 am
Then it does not need to intalar nothing of the customer against the account (resale) I only install this script in my server where it will have backups and ready….
on July 11th, 2007 at 11:31 am
that's right!
on July 11th, 2007 at 11:42 am
plus a doubt if for example I only have 600 domínios to make backup, as I make to make backup of 600 domínios the same at the same time using script?
on July 11th, 2007 at 11:43 am
Well, that all depends on the server you're backing up to, if it can handle that many connections
on July 11th, 2007 at 11:46 am
You it would know to say me as to use script for all the same the usários at the same time?
on July 11th, 2007 at 11:49 am
I don't know. If I were you, I wouldn't do all at the same time, I would stagger them
on July 11th, 2007 at 11:57 am
don't know. If I were you, I wouldn't do all at the same time, I would stagger them Certain, it is that you with this problem to solve and necessary to find a solution for these backups external now….Debtor for the aid and will have some idea would be been thankful
on September 2nd, 2007 at 5:54 am
Hi there,
Thanks for the awesome script. It's exactly what i was looking around for and saved me hours of work
Cheers, ToNy!
on September 26th, 2007 at 5:45 pm
This is a good script and it inspired me to create CPSafe, which allows for multiple scheduled site and database backups to a remote FTP server. Thanks Justin!
on November 1st, 2007 at 9:00 pm
Thank you!!!
on November 26th, 2007 at 9:18 am
I created the following awhile back to perform hourly mysql backups, archive em, and ftp em.
This will do just that and send the backups to the FTP server. If the FTP server is down it will just store it locally until the server is back up. When the server is backup it will send all the ones locally over to the FTP server the next time it is run.
*Designed for PHP5….
exec('nice -n 19 bzip2 "'.$localdir.'/'.$backup_name.'.sql"');
exec('chown -R '.$owner.':'.$owner.' "'.$localdir.'"');
// FTP Connect, home server
$ftp_id = ftp_connect($ftphost, 21, 20);
$ftp_login = @ftp_login($ftp_id, $ftpuser, $ftppass);
// Create the backup folder
@ftp_mkdir($ftp_id, $ftpdir);
if ($ftp_id) {
// Read the backup directory and FTP the contents to home server
if ($handle = opendir($localdir)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (ftp_put($ftp_id, ftpdir.'/'.$file, $localdir.'/'.$file, FTP_BINARY)) {
unlink($localdir.'/'.$file);
}
}
}
@closedir($handle);
}
@rmdir($localdir);
}
// Close the FTP connection
@ftp_close($ftp_id);
?>
on November 26th, 2007 at 9:24 am
I created the following awhile back to perform hourly mysql backups, archive em, and ftp em.
This will do just that and send the backups to the FTP server. If the FTP server is down it will just store it locally until the server is back up. When the server is backup it will send all the ones locally over to the FTP server the next time it is run.
*Designed for PHP5….
http://www.xtraticwar.com/snippets/backup.php
on January 15th, 2008 at 9:43 pm
Is there a maximum file size that can be used with this script? I cannot make a full cpanel backup manually through the cpanel interface because there is a 5GB limit. I have 20GB of files, mostly images. Can this script, through cpanel still perform a valid backup using this direct method? Thanks for any feedback and ideas if it does not work for me.
on January 17th, 2008 at 2:18 pm
I am getting the following error, similar to Bob a few months back. I cannot figure out why. I can login to the web server manually from my desktop using the same parameters. I get a report to my email saying all backed up, but I assume the FTP is what is failing.
Can't call method "login" on an undefined value at /usr/local/cpanel/bin/ftpput line 28.
Thoughts on what to try?
on February 10th, 2008 at 12:23 am
Check out the following link. It's a PHP script that will download all your CPanel backups and databases off-site, automatically.
http://www.cpdatabackup.com
on March 4th, 2008 at 7:23 am
i am running it on my server, everything was setup as you told, the backup file is created during the backup process in ~/ but then automatically deleted at the end of completeion of the script, why so?
on March 5th, 2008 at 9:15 pm
i have a cpanel account where the host disabled the backup button in the cpanel.
would i be able to use this script to do a backup?
on March 19th, 2008 at 3:25 am
Justin, Thanks for the script!!!! I get the error below like Ron though,
Can’t call method “login” on an undefined value at /usr/local/cpanel/bin/ftpput line 28.
No file on target location. Any fix?
THANKS
Srini
on March 19th, 2008 at 5:00 am
http://www.drivehq.com is compatible with this script … and it's free too!
on March 27th, 2008 at 8:28 am
Looked sweet, but my PHP wasn't able to perform. Here's how to backup your cPanel account automatically with curl (provided you have curl enabled in your account).
on March 31st, 2008 at 5:58 am
I am getting the following errors when the script runs, any help people could off would be appreciated.
//home/powder/fullbackup.php: line 1: ?php: No such file or directory
//home/powder/fullbackup.php: line 3: //: is a directory
//home/powder/fullbackup.php: line 4: syntax error near unexpected token
`('
on April 3rd, 2008 at 11:15 pm
Well I started developing a way for the backup on the server your backing up to delete after its been moved to the remote FTP server. Only problem I'm having is getting permissions to delete the the file. I have tried php functions such as chmod, also tried making a script to log in FTP and chmod that way but still getting failure. If anyone has a good technique tell me and I can finish this baby up and release it to you guys. I'm sure some of you would appreciate your original server not being bogged up with backups which you have already moved to another location
on April 16th, 2008 at 10:17 am
Would this work for a reseller account and backup all the accounts under it?
on April 19th, 2008 at 6:05 pm
I have been looking for something like this for weeks
)
Could you tell me:
my isp allows me to up-and download 10GB/month. Would backing up to a remote server have effect on my counter?
on April 22nd, 2008 at 11:57 am
Hi there,
If I login to CPanel with the reseller account I can switch throw my clients account and create for each of them backups on a remote server. It would be nice to be able to add a cronjob to run this script but using my reseller credential. I don't know the c-panel user/pass for all my clients!
Any idea ?
Thank you in advance !
Gabi
on May 11th, 2008 at 1:56 am
Is it possible to set it to copy all databases, but only certain directories?
on June 5th, 2008 at 2:34 pm
WOW… I've also been looking for a way to backup my gaming forum site for a while now and come nowhere and then I stumbled onto this.
Had to figure out I was using x3 skin and put .com instead of .org on my FTP account (DOH!) but now it will handle it automatically.
Thanks for this wonderful piece of code…
NeoMorph
(admin – ethicalgamer.com)
on June 15th, 2008 at 7:44 pm
Justin, thanks for the nice script. I was looking for something to do a full backup of one of my active sites. The script worked with no issues.
on June 19th, 2008 at 4:09 pm
hi justin.
is it possibile to send the generated backup file to an email address?
on June 26th, 2008 at 12:44 am
John said,
on November 26th, 2007 at 9:24 am
I created the following awhile back to perform hourly mysql backups, archive em, and ftp em.
This will do just that and send the backups to the FTP server. If the FTP server is down it will just store it locally until the server is back up. When the server is backup it will send all the ones locally over to the FTP server the next time it is run.
Hi John
I can't get your script to work. I put it in a text file, renames it with "php" as the file extension, uploaded it and set a cron job to run it but nothing happens. Are there any variables in it I should have amended, and if so, can you specify with examples please?
on June 26th, 2008 at 6:46 am
can we use sftp?
on July 17th, 2008 at 8:09 am
Hi Justin,
Thanks for the great script, I appreciate your efforts. I was wondering if you've seen this problem yet. When I run the script everything seems to go as planned except the file that is uploaded to my ftp server is empty (0kb). There is no other file uploaded besides this. Any ideas?
Thanks for the help.
on July 22nd, 2008 at 8:32 am
I am never done this before, but can someone please tell me how can I start the cron job.
To schedule the script to run regularly, save it as fullbackup.php in your top directory (not /public_html, which would be less secure), and enter a new cron job like the following:
15 2 * * * /usr/local/bin/php /home/youraccount/fullbackup.php
What program should I use to do that? Or where do I insert this?
on July 23rd, 2008 at 1:12 am
i am getting this error in my email:
/bin/sh: 15: command not found
can you tell me what does it means?
on August 8th, 2008 at 1:22 am
I have the script in place and it looks to work perfectly, if i look in cpanel it says the backup is generating and I see the ackup file being generated on the server, then when it finishes where it said the backup was in progress, it just disappears and the file that was being generated also just disappears
Has this happened to anyone else, if not any clues as to what the problem could be?
Thanks
on August 19th, 2008 at 9:51 am
works great! thanks a lot for posting.
on August 27th, 2008 at 1:12 pm
someone posted something about this error:
/frontend/…/dofullbackup.html file does not exist.
i had the same thing and the problem was the path to the fullbackup.html was incorrect because it was using a different skin.
to check for sure what this path should be go to your cpanel, go to backup, hover your mouse over the "download generate full backup" button…look at the url that is behind that button..that is the path you should use in this php file.
search the file to find where fullbackup.html is called and update it there.
mine was originally set to "x" which is the default…but my skin is actually in a directory called "x3"
on September 5th, 2008 at 8:03 pm
Thank you, just what I was looking for, I installed it and at first try, it worked!
on September 8th, 2008 at 8:36 am
Hi, Justin! Is there any way to make similar to this script for automatic creation of databases and assigning users to them. Or please, direct to how create scripts for automatical use of Cpanel. Rights for creating database outside CPanel I don't have and there is a need for multiple creation of db.
THanks.
P.S. Sorry, for writting in this section. Din't find any other fitting my question.
on September 30th, 2008 at 6:46 pm
Hi, is there anyway to get this script to do the backup but not the ftp portion. We do not have or want an internal ftp server so we want to initiate the downlaod from our internal backup server. I have tried putting homedir in the ftpmode but does not seem to work/
on October 7th, 2008 at 4:56 am
Great post. This is just what I was on the lookout for.
on October 17th, 2008 at 7:04 am
Snx for Automatic cPanel backup info. it realy healp me !
on October 26th, 2008 at 5:18 am
Question,
I've read your script and it looks like it is for a single domain on a server running cPanel. Is there and easy way to use cron for backing up all the domains and sql databases for numerous domains that reside on a server?
on November 1st, 2008 at 11:10 pm
[...] Here is an easy DIY way to back up your whole site with cPanel. [...]
on November 8th, 2008 at 3:20 pm
Wow, thank you, i just finnished installing it, i'll know if it worked in an hour =D
on November 9th, 2008 at 10:57 am
Hi all,
i had troubles with ftp upload because the script tried to upload in ftp home dir, where the remote user has not write access.
I added a $rdir parameter with the remote dir (like the complete cpanel's script does).
like this
ftp params
$rdir="home/choosendirforbackups/"
$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&rdir=$rdir&submit=Generate Backup";
hope this can be useful.
T
on November 12th, 2008 at 10:02 am
Hi Justin,
I've tried your script but I get this mailed to me by the Cron Daemon:
" /bin/sh: 15: command not found "
I checked with my hosting company and we did change the file path to the file, but this may be something else.
Any idea what this means?
THanks again for providing this script. Once I get the kinks worked out it will be really great!
on November 14th, 2008 at 4:38 am
Will this work for an SCP connection also?
on November 14th, 2008 at 3:01 pm
Absolutely the coolist app I've found! You just saved me at least 6 hours a month of loggining into remote sites and backing them up.
on November 14th, 2008 at 3:07 pm
[...] Learn more about this cool app! [...]
on November 22nd, 2008 at 10:55 pm
hihi,
this script is not working le.
i tried and the CRONS LOG keep sending me some funny stuff like this.
/home/atomenet/fullbackup.php: line 1: ?php: No such file or directory
/home/atomenet/fullbackup.php: line 3: //: is a directory
/home/atomenet/fullbackup.php: line 4: syntax error near unexpected token `('
and some password rant
anyway, i remember the first 4 lines are all // comments.
wondering why
on December 16th, 2008 at 8:31 pm
Im also having the same problem as Jerome does anyone know why im getting this?
on December 18th, 2008 at 6:28 pm
[...] read this great post today that shows how to automatically backup cPanel with PHP and a cron job. The guy that wrote this recommends that you keep the file on the server you want to backup, but I [...]
on December 20th, 2008 at 4:36 pm
Hi Justin, many thanks for your script. Great work.
I've set it up on my server and ran the cron job. I know that the cron job found the file and ran it – but I'm not sure if anything happened.
I didn't receive the email from the script – and I can't find the back up file though on my destination ftp account.
I'm sure that the cpanel username and password are correct.
I've tried putting in "www" in front of the domain – and then taken it out when it didn't work.
I've tried ftp and passiveftp – now reset to ftp.
I'm sure the ftp username, password and the ftp hostname are correct …
If I didn't receive the notification email, does that imply the script didn't run? Or I have a config value wrong?
Could you please tell me where should I look to find the backup and what I should be looking for?
Many thanks in advance,
James
on December 26th, 2008 at 3:53 pm
[...] Option for those using Cpanel Hosting is to use this handy script from Justin Cook and have automatic backups of you entire website hosting account. The advantage to this method is [...]
on December 29th, 2008 at 10:26 am
[...] ini aku temukan di Blognya Justin Cook. Setelah dicopy paste dan edit di bagian username dan password cPanel serta FTP tujuan, maka upload [...]
on January 4th, 2009 at 7:01 pm
[...] server get set up ASAP. Instead, we automated nightly FTP backups of each of our sites using this nifty script for automatic cPanel backups. In the event of disaster, I simply take the .zip file with all of our code and databases, upload [...]
on January 6th, 2009 at 9:57 pm
how about reseller backup?
on January 16th, 2009 at 7:32 pm
Thanks for the script Justin – have it setup now and look forward to hopefully have the script running with automated backups on a daily basis.
Quick question: any options for sftp at some point – Dreamhost.com offers an excellent FTP backup service. Would be great to have safer options than ftp as treansfer protocol.
Anyway, thumbs up so far!
/Mads
on January 17th, 2009 at 10:35 am
When trying to rung the script I get this output – any ideas??:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /usr/my_user_name/fullbackup.php on line 7
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /usr/home/my_user_name/fullbackup.php on line 8
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /usr/home/my_user_name/fullbackup.php on line 11
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /usr/home/my_user_name/fullbackup.php on line 13
Parse error: syntax error, unexpected T_VARIABLE in /usr/home/my_user_name/fullbackup.php on line 15
on January 18th, 2009 at 8:13 pm
I tried to test it by executing the script manually and i get a server error:
The server encountered an internal error or misconfiguration and was unable to complete your request.
Any help with this ?
on February 3rd, 2009 at 9:29 am
[...] Here is an easy DIY way to back up your whole site with cPanel. [...]
on February 9th, 2009 at 12:19 am
Great script! Very useful since I don't have root access to back up automatically. Is there a script to grab the sql databases specifically? My file directory has gigs of data which doesn't need to be backed up too often.
on February 15th, 2009 at 9:11 pm
Hey, Thanks for this great script. Installed with ease.
I know this has been asked before but didnt see any responses.
Can the file transfer be done via sftp? I tried changing "ftp" to "sftp", to no avail. Any help will be greatly appreciated!
on February 15th, 2009 at 9:17 pm
[...] I came across this blog of this genius that has created a script to automate cPanel backups. Previously, I would have to do this manually. I have shared boxes, VPS and am currently in the process of shipping a pimped box for colo. In the mean time, as on WHM on my shared account doesnt allow automated backups, i have installed this script to create full backups and push via ftp to my remote server! This also includes all domains, emails, "sql" as well. So happy I found this script. I am currently looking to see if I can use SFTP instead of ftp. Why not make the transfer as secure as possible.. Shout out to Justin Cook [...]
on February 28th, 2009 at 7:50 pm
I got an email saying
Could not open input file: /home/fullbackup.php
on March 8th, 2009 at 1:20 am
[...] Web Hosting Galore 08 Mar 2009 @ 6:20 AM Resellers Backing up All Clients I found this script very handy when I was on a reseller package and trying to manage the clients. After about 5 clients or so, making backups of their accounts is not a very fun task. So I did some searching and found this [...]
on March 8th, 2009 at 1:18 pm
[...] Learn more about this cool app! [...]
on March 9th, 2009 at 9:19 pm
[...] would do a full cpanel backup, and FTP it to the location of your choice. The script can be found here. To set this up, it requires editing the file with your cpanel and FTP credentials, as well as a [...]
on March 13th, 2009 at 8:36 am
[...] Option for those using Cpanel Hosting is to use this handy script from Justin Cook and have automatic backups of you entire website hosting account. The advantage to this method is [...]
on March 14th, 2009 at 7:45 am
very cool script indeed
thanks very much man…
on March 16th, 2009 at 12:54 am
Thank you Justin Cook, you have saved me hours of work each week with this simple automation script. I'll only have to trim down the storage directory once a month. you LEGEND!. I can not thank you enough… Namaste
on March 21st, 2009 at 11:44 pm
well, this is just what I was looking for…
time to try it :p
on April 19th, 2009 at 12:12 pm
This script has worked great but recently started refusing to delete the GZip file in my home directory when it's done. Little help?
on April 24th, 2009 at 1:13 am
[...] are scripts to do backups for you automatically through a cron. Here is one that looks [...]
on April 26th, 2009 at 9:08 pm
Hi James
Thanks for this script. I tried it and it works with no issues with my cpanel account.
I will write a note about it in my blog.
Thanks again.
on May 5th, 2009 at 10:51 pm
Just wanted to add my 'thank you' for this excellent script. Only thing I had to do was change the 'theme.' My host is using the x3 theme. Everything worked great out of the box!
on May 15th, 2009 at 1:14 pm
[...] Another Option for those using Cpanel Hosting is to use this handy script from Justin Cook [...]
on May 15th, 2009 at 1:16 pm
[...] Learn more about this cool app! [...]
on May 18th, 2009 at 7:53 am
[...] Here is an easy DIY way to back up your whole site with cPanel. [...]
on May 23rd, 2009 at 8:16 am
Can anyone help me? I'm getting this message when I run the script (and the XXXX's are only there to protect the innocent!:
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/XXXX/fullbackup.php on line 38
Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.XXXX.com:2082 in /home/XXXX/fullbackup.php on line 38
Failed to open socket connection… Bailing out!
Thanks for any help that anyone can give.
on May 26th, 2009 at 8:05 pm
Thank you so much for the script! That is amazing.
BTW, wouldn't your second cron job (15 2 * * 1 /usr/local/bin/php /home/youraccount/fullbackup.php) actually run on Monday, as Sunday is 0?
on May 28th, 2009 at 2:32 am
can anyone recommend where i can ftp the backup to? Is it worth sending it to another account i have with the same hosting provider (that may be on the same server/location so if that place was destroyed the backup would be too?).
on June 8th, 2009 at 5:55 am
Hello. I tried your script, it sends me the log through email the it has successfully created the backup, but the backup just isn't there! No archive, no nothing!
What could be the issue? If it helps, i'm using hostgator.
Thank you.
on June 10th, 2009 at 2:04 am
[...] Here is an easy DIY way to back up your whole site with cPanel. [...]
on June 14th, 2009 at 5:19 pm
Great Work sir! Can you help me set this script up via a shared session?
on June 18th, 2009 at 12:48 am
[...] malo. Decidí investigar de respaldos automáticos con cpanel y me encontré con la entrada Automatic cPanel backup (domain & MySQL) with cron & PHP de Justin Cook. Allí hay un script para ejecutar la petición de respaldos completos de cpanel con [...]