
Update June 15th 2009: the backup archive file wasn’t excluded from the archive itself as expected. This problem has now been solved. GoDaddy Backup Script v1.0 is now available for download.
Update March 26th 2009: the script have been updated so that the archive name is now timestamped and the actual TAR file is exluded from the backup as suggested by zoJazz in the comment section.
Last night, I was going through my GoDaddy control panel trying find a way to backup my website files and database.
Turned out after going circles for a while, I went through their knowledge base and found nothing about it. The only backup articles found were related to VPS and Dedicated Servers. So unfortunately, there is no straightforward way to backup your whole website at once.
After searching the web, I finally found an interesting post over at alvinzhang.info showing how to backup your GoDaddy website using a shell script and a cron job. While the solution posted there does work, here’s a bonified version which allows to backup your website from a PHP web page.
I have created a PHP script that will allow you to download a full backup of your website. The script makes use of the tar command through shell_exec(). Depending on the size of your website, this backup tool may not work due to the PHP execution time limit configuration.
Although this script was originally developed to backup my GoDaddy website, it can probably be used with any Linux / Unix web host.
How To Use The Backup Script
Unfortunately after spending hours trying to backup MySQL databases on GoDaddy hosting, I finally found out that the mysql client installed on the web server is outdated. Since GoDaddy uses different servers to host the MySQL databases, it was not possible to use the mysqldump command to backup the databases remotely.
There’s an article over here that shows you how to backup your GoDaddy MySQL databases using a cron job so if you’re lucky, the MySQL client may not be outdated on the server hosting your website.
Still, you can use GoDaddy’s control panel to backup your databases manually.
* Use of this backup script is at your own risks. I am not responsible for any problems that can be caused by its usage. Feel free to post any recommendations and bug report here.
Posted in Control Panels · GoDaddy · Misc · Tutorials | 36 Comments

36 responses so far ↓
1. Response by : zoJazz on Jan 23, 2009 at 2:04 am
Thanks! This works great for a quick, full-site backup. I wanted to timestamp the file and exclude the actual tar file from being included, which was almost doubling the size, so I modified it a bit. If you want those changes, just replace the BackupSite function with:
function BackupSite() { $archname = ‘fullsite_’ . date("Y-m-d-H-i-s") . ‘.tar’; $output = shell_exec(‘tar -cvz –exclude=’ . $archname . ‘ -f ./’ . $archname . ‘ .’); ?> <p>Backup completed<br /><a href=<?php echo $archname ?>>Click here to download your backup</a></p> <p><em>Don’t forget to delete <?php echo $archname ?> and mysql-backup when you’re done!</em></p> <?php }
Thanks again.
2. Response by : Quick Update on GoDaddy PHP Backup Script on Feb 3, 2009 at 12:01 am
[...] February 3rd, 2009 · No Comments I couple of weeks ago, I made a post on How to Backup Your GoDaddy Website. [...]
3. Response by : wharfratjoe on Feb 17, 2009 at 1:17 pm
I am receiving the following error when trying to run yjis on one of my godaddy hosted websites:
Parse error: parse error, unexpected T_STRING on line 60
4. Response by : zoJazz on Feb 18, 2009 at 12:07 am
@wharfratjoe – If you pasted the additional code in above, that is causing your error – it got mangled when I pasted it here. Download the sitebackup.php from the link above that was updated by the original author and it should work fine.
5. Response by : Graymerica » Blog Archive » The pain of moving a site away from Godaddy or ********* Godaddy on Feb 18, 2009 at 11:26 am
[...] found on google, such as phpshell, cron, shell script. To be fair, I did not try this approach, How to backup Godaddy, but it looked like it had the same limitations as the other. After all that, I gave up and [...]
6. Response by : carltonb on Feb 22, 2009 at 4:15 pm
How can one verify backup, besides untaring file?
7. Response by : maher on Feb 27, 2009 at 4:09 pm
Thank you
Worked just fine for me
8. Response by : wharfratjoe on Feb 28, 2009 at 1:31 am
It is working now. I think I may have used the old file originally. However I recently noticed some php items i had running for php5 stopped working at godaddy. looks like they downgraded the server(s) my site is on to php4.x.
9. Response by : wharfratjoe on Feb 28, 2009 at 3:13 am
Is there a limit on the size of a website that this tool will allow to be backed up or is this a GoDaddy limitation?? My site is close to 2gigs and every backup I ran with this was only about 161megs when it said it was completed and the tar file was corrupted (broken).
10. Response by : Stephane Brault on Mar 22, 2009 at 11:48 am
It’s not much about the size of your website but rather the time limit for executing PHP scripts.
11. Response by : capalog on Mar 26, 2009 at 7:19 am
Hmmmm… this ALMOST works for me except for the timeout thing. My filesize caps at about 140MB and I need about 250MB. Is there a way to increase the timelimit allowed to execute PHP Scripts?
12. Response by : Stephane Brault on Mar 26, 2009 at 7:37 am
You could try adding this line at the beginning of the script :
< ?php ini_set('max_execution_time', 300); ?>
or if you’re hosting on a Linux server, you could add this to your .htaccess file :
php_value max_execution_time 3000
But I highly doubt GoDaddy allows their users to override this limit.
13. Response by : capalog on Mar 26, 2009 at 7:51 am
Yeah, I tried doing this (and also putting “$max_execution_time = 300;”) but still didn’t work… bummer.
14. Response by : Matt on Apr 7, 2009 at 1:48 pm
The script works great but I do not get the link to the download at the end. I can go to my ftp client and the file is there but no link on the webpage. Any thoughts? and Thank You!
15. Response by : GoDaddy Backup Script Updated to v1.0 on Jun 15, 2009 at 9:31 am
[...] 15th, 2009 · No Comments In late January 2009, I made a post about a PHP script I developped to help GoDaddy users to backup their website. The script creates a “gzipped tarball” of all the files and directories in your [...]
16. Response by : Mike on Jun 20, 2009 at 10:54 am
Mine has two issues…
Like Matt, mine doesn’t end up providing a download link.
Also, it always maxes out at about 150mb. It has at least another 200mb to go.
It’s just not getting all of the files into the tar.
Any idea why? I increased the timeout to 6000 and still just get 150mb.
Thanks!
17. Response by : Tayloe Gray - Marketing and Business Consulting on Jun 22, 2009 at 6:05 pm
[...] found on google, such as phpshell, cron, shell script. To be fair, I did not try this approach, How to backup Godaddy, but it looked like it had the same limitations as the other. After all that, I gave up and [...]
18. Response by : John on Jul 13, 2009 at 10:55 pm
Why do it manually?
It would be easier in CRON like this:
Bash: #!/bin/bash
tar -cvvf /$HOME/html/fullsite.tgz
The 1st line is important to tell the CRON daemon what interpreter to use.
Here are more tips straight from GoDaddy:
The Command field is the script or executable that runs at a specified frequency. Click Browse to locate a file in your hosting account. The full file name of your selection is placed into this editable field.
Cron commands are typically script files that have executable permission and specify their interpreter as the first line of the file. For example, a first line of “#!/usr/bin/perl” directs the system to run the perl language interpreter for the file.
Your Shared Hosting account supports the following languages and associated interpreter lines:
* Perl: #!/usr/bin/perl
* Python 2.2: #!/usr/bin/python2.2
* Python 2.3: #!/usr/bin/python2.3
* Python 2.4: #!/usr/bin/python2.4
* Ruby: #!/usr/local/bin/ruby
* Bash: #!/bin/bash
The installed versions of PHP 4 and PHP 5 do not support the interpreter specification in a PHP file. In order to run a PHP script via Cron, you must specify the interpreter manually. For example:
* PHP 4: /web/cgi-bin/php “$HOME/html/test.php”
* PHP 5: /web/cgi-bin/php5 “$HOME/html/test.php5″
Note: In this example script, “$HOME” represents the full path to your Shared Hosting account. The actual path to your account will be provided if you select the script from your account using the Browse button.
19. Response by : Stephane Brault on Jul 17, 2009 at 3:35 pm
Hi John,
Thank you for your valuable comment.
The script was meant to do a one-time backup of an account and in order to keep as simple as possible, I made it useable from a web page so that less experienced users don’t have to bother with CRON.
Am I wrong or your script’s tar options wouldn’t exclude the archive itself from the backup?
The other thing is that you’d have to check regularly your hosting account to download and remove the backup file to prevent it from being downloaded by other users.
20. Response by : Hesham on Jul 19, 2009 at 10:13 am
You have a great tool, I have just tried it on one of my testing hosting, works like a magic! you really saved me lots of time and efforts with this great code!
Thanks a lot!
21. Response by : Jonny | thelifething.com on Sep 7, 2009 at 3:28 pm
Amazing bit of script, worked really well first time. Thanks a lot.
Please excuse my incompetence but should I need to restore my website to the backup file, how do go about doing this?
Thanks,
22. Response by : GP on Sep 20, 2009 at 1:20 am
This is such a time saver! Bless you for giving this free!
23. Response by : Kevin on Sep 24, 2009 at 3:05 pm
This was exactly what I needed. Thanks for a great and easy to use script. It worked perfectly the first time.
24. Response by : How To Completely Backup your GoDaddy Website Files | Web Design Philippines | MikeWagan.net on Nov 26, 2009 at 9:12 am
[...] Use a PHP script – The Web Hosting Hero has created a PHP script that can take care of backing up your website’s files thru your browser. It basically compresses your site into a tar.gz file for easy download. Download the script and the instructions from The Web Hosting Hero. [...]
25. Response by : Martha on Jan 19, 2010 at 2:37 pm
I kept having problems with php errors so I just went with a shell script instead. Although the php script looked really great. I think Godaddy’s CRON manager is just picky or maybe it just didn’t like me. In any case, I used a script here http://www.fortasse.com/2010/01/tutorials/tutorial-automatic-backup-script/ and it seems to be working… for now! If it stops, I’ll revert back to php and see what happens. Thanks for the info!
26. Response by : Lisa on Feb 15, 2010 at 4:56 pm
Hi,
Many thanks for the script – this worked just great. All other solutions were timing out for me, but this one worked.
I would also like to see an option to exclude any existing archives from being added to the new archive.
Also – why is “mysql-backup” directory created?
Thanks!
27. Response by : Dave on Feb 20, 2010 at 4:17 pm
Hi I installed it and clicked backup be I didn’t get a link to download the back-up. Any Ideas?
28. Response by : Chuck on Mar 13, 2010 at 1:21 pm
I am using the script mentioned – but I keep getting crc errors when I use winrar to open the file. Is there any way to make this an rar file instead. I am completely unfamiliar with tar so am totally lost.
29. Response by : Matt on Mar 25, 2010 at 8:56 pm
Used the script, “MySQL backup directory successfully created.” However, no link returned and where would the file be?
30. Response by : Matt on Mar 25, 2010 at 8:58 pm
…Yeah it created a new directory “mysql-backup” but no file…
31. Response by : Matt on Mar 25, 2010 at 8:59 pm
Edit – had to refresh its there!
32. Response by : 249 Designs on Jun 20, 2010 at 4:44 am
“there is no straightforward way to backup your whole website at once” That is really bad for a company that hosts websites. You would think they would push backs and a means of making more money. Even is it is on shared hosting; you can by a backup system on Dedicated, vps hosting.
33. Response by : The Web Hosting Hero on Jun 21, 2010 at 8:28 am
@249 Design: I totally agree.
34. Response by : Rara on Jul 5, 2010 at 5:30 am
I want to download GoDaddy Website Backup Utility. Thanks you.
35. Response by : Dinesh on Jul 15, 2010 at 11:33 pm
hi,
it’s very valuable script, save lots of time
thank you for sharing
Dinesh
36. Response by : Joseph on Jul 16, 2010 at 4:31 am
To bad that they do not have a full site backup utility. It really sux..
Leave a Comment