flemingmike Posted October 5, 2010 Share Posted October 5, 2010 hi, im looking for a way to make a page that will backup my mysql when i click a button and i can save it locally on any machine i use. anybody able to help me out with what to search in google? thanks! Link to comment https://forums.phpfreaks.com/topic/215209-backup-question/ Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2010 Share Posted October 5, 2010 php backup mysql Link to comment https://forums.phpfreaks.com/topic/215209-backup-question/#findComment-1119280 Share on other sites More sharing options...
flemingmike Posted October 5, 2010 Author Share Posted October 5, 2010 i found this, i configured it, and it does nothing. do i have to call a command at all? <?php include 'config.php'; include 'javascript.php'; $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); include 'close.php'; ?> Link to comment https://forums.phpfreaks.com/topic/215209-backup-question/#findComment-1119282 Share on other sites More sharing options...
anups Posted October 5, 2010 Share Posted October 5, 2010 u can directly use exec function. $filename = bk.sql; exec("mysqldump -h lhostname -u username --password=dbpassword > $filename"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Content-type: application/zip;\n"); //or yours? header("Content-Transfer-Encoding: binary"); $len = filesize($filename); header("Content-Length: $len;\n"); $outname="downfile.zip"; header("Content-Disposition: attachment; filename=\"$outname\";\n\n"); readfile($filename); Link to comment https://forums.phpfreaks.com/topic/215209-backup-question/#findComment-1119283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.