Jump to content

Compress to .gz


Asheeown

Recommended Posts

I'm making a .csv file and I want it to be compressed to the filename.csv.gz so I have this:

 

function compress($srcName, $dstName)
{
  $fp = fopen($srcName, "r");
  $data = fread ($fp, filesize($srcName));
  fclose($fp);

  $zp = gzopen($dstName, "w9");
  gzwrite($zp, $data);
  gzclose($zp);
}

 

and it works...well for the most part, when I do a file that is very large it just doesn't compress the file, it does do it for small queries such as 200,000 to 1,000,000 records but just about anything above that doesn't compress, any ideas?

Link to comment
https://forums.phpfreaks.com/topic/36526-compress-to-gz/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.