&1", $output); // create zip file $z = new ZipArchive(); $z->open($dir_zip, ZIPARCHIVE::CREATE); $z->addFile($dir_sql); $z->close(); // remove sql file @unlink($dir_sql); echo "Backup file created at {$dir_zip}";