Jump to content

backup question


flemingmike

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.