gzencode and save archive
function gz_archive($file_path, $output_file, $level = 5) { $buffer = ''; $gz = gzopen($output_file, 'wb' . $level); $file = fopen($file_path, 'rb'); while (!feof($file)) { $buffer = fread($file, 10240); gzwrite($gz, $buffer); } gzclose($gz); fclose($file); }