I have a script to download a dump of my database, but the file is getting large. I tried compressing it with :
$dump = `mysqldump -u $username -p$password $dbname`;
$fp = fopen('php://temp', 'r+');
stream_filter_append($fp, 'zlib.deflate', STREAM_FILTER_WRITE, array('level' => 9));
fputs($fp, $dump);
rewind($fp);
//Envoi du "fichier"
$this->setLayout(false);
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: SQL Dump");
header('Content-Disposition: attachment; filename="mydump.sql.zip"');
$this->fichier = stream_get_contents($fp);
But that creates an invalid zip file. Am I missing something ?
EDIT
There must be somthing wrong in the headers too, Firefox shows the file as "HTM document", and I can't show a filesize.