I am using for the first time ifsnop/mysqldump-php
to backup a mysql database. Works fine, does the job, including blob fields (the reason I went with it).
By default it saves the dump file online as a txt\sql file in a given folder on the server.
I need to save it locally and get thesave as
window where I can choose the location on my computer.
The basic script I have is:
<?php
include_once('../myfolder/mysqldump-php-master/src/Ifsnop/Mysqldump/Mysqldump.php');
$dump = new Ifsnop\Mysqldump\Mysqldump('mysql:host=myhost';dbname=myname', 'myuser', 'mypassword');
$dump->start('mybackup.sql');
?>
I tried something like the code here below, that generated a downloadable file, but I can't seem to get the dump content into the variable $content
and write it into the file.
<?php
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\""mybackup.sql"\"");
echo '$content'; exit;
?>