Du udsender ikke din $final
data. Jeg bruger denne kode til at gøre præcis det samme, prøv det...
header('Content-Description: File Transfer');
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $backup_filename . '.sql');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($final));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
header('Pragma: public');
echo $final;