mysql backups

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cardi777
Forum Commoner
Posts: 54
Joined: Sun Mar 29, 2009 4:26 am

mysql backups

Post by cardi777 »

hi all.

I have this code but it doesn't something is wrong.

it makes the file, then downloads it, but it hasn't done much at all. No database in that gzip :P

Code: Select all

 
$backupFile = $dbname . date("Y-m-d-H-i-s")  . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > ../db_backups/".$backupFile;
system($command);
 
header("Content-type: application/x-gzip");
header('Content-Disposition: attachment; filename="../db_backups/'.$backupFile.'"');
 
any ideas!?

Cheers,
Doug
cardi777
Forum Commoner
Posts: 54
Joined: Sun Mar 29, 2009 4:26 am

Re: mysql backups

Post by cardi777 »

found a great class, don't worry bout this
Post Reply