$stream = fopen('', 'r'); $file = fopen('backup.zip', 'w'); while(feof($stream)) { $buffer = fread($stream, 1024); fwrite($file, $buffer); } fclose($stream); fclose($file);