View Full Version : Auto-backup question
Rob_York
4-16-09, 10:09 AM
Hi there,
I recently read that it's a good idea to setup a PHP/MySQL powered auto-backup "thing" (would you call this sort of thing a program?) to automatically download a copy of a MySQL database for say a phpBB3 board.
I have two questions about this:
1) as this relates to auto downloads/uploads, is it permitted within the ToS?
2) if it is permitted, is it easy to get set up?
Thanks,
Rob
YvetteKuhns
4-16-09, 10:27 AM
You can set up a cron job to run a script that backs up the database. I think it is safer to simply remember to login to phpmyadmin and export a copy of the database, but since you are running a forum, you probably want daily backups. Be sure to run the backup when your forum has the least amount of activity.
See How to e-mail yourself an automatic backup of your MySQL database table with PHP (http://www.theblog.ca/mysql-email-backup) for one way to do it. There is a zip file you can download.
See backing up a huge mysql table using php and a cronjob (http://stackoverflow.com/questions/297038/backing-up-a-huge-mysql-table-using-php-and-a-cronjob) for other ways.
I don't recommend emailing the backup files. They can be LARGE and it isn't secure to send login info via email.
Dbrazzell
4-16-09, 12:21 PM
See How to e-mail yourself an automatic backup of your MySQL database table with PHP for one way to do it. There is a zip file you can download.
That is pretty slick. One thing you might consider is modifying this script to just dump the sql file into your hosting account and not email it to you.
That script is really simple and all it does is first dumps a file to your account second it emails it to then third it removes the file it created.
You could just cut out the email part and possibly add something that deletes .sql files if older than $x date.
Its a really great idea to have regular backups in .sql format. This way if you do something silly or your site gets hacked or something like that you can always go back one or two days.
Plus I cant tell you how happy I used to be when a customer would put in a ticket saying they did $x dumb thing to their account and needed a backup. However they had good .sql files already for me to use.
entrecon
4-16-09, 12:34 PM
Would it be possible/suggested to write this file above htdocs?
YvetteKuhns
4-16-09, 01:24 PM
You could just cut out the email part and possibly add something that deletes .sql files if older than $x date.
The email part should notify you that your database backup has been completed. If you don't get the email notification, you may forget to retrieve the backup or your script may not be working!
Would it be possible/suggested to write this file above htdocs?
I think you can use the file path specified in OPS (up to but not including htdocs) but I haven't tried it here. We can upload files there, so I don't see why not.
Rob_York
4-17-09, 09:56 AM
Hey guys, thanks for the tips. I'll get cracking with this when I get everything else working! :)
Rob
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.