php gzip xml file (53MB) casue Out of memory error

Posted by ntan on Stack Overflow See other posts from Stack Overflow or by ntan
Published on 2010-03-29T12:48:39Z Indexed on 2010/03/29 12:53 UTC
Read the original article Hit count: 249

Filed under:
|

Hi,

i have a 53 MB xml file that i want to gzip.

The code below gzip it

$gzFile = "my.gz";

        $data = IMPLODE("", FILE($filename)); 
        $gzdata = GZENCODE($data, 9); 

        //open gz -- 'w9' is highest compression
        $fp = gzopen ($gzFile, 'w9');       
        //loop through array and write each line into the compressed file       
        gzwrite ($fp, $gzdata);

        //close the file
        gzclose ($fp);

This cause

PHP Fatal error:  Out of memory (allocated 70516736) (tried to allocate 24 bytes) 

Any one have any suggestions.

I already have increase the memory in php.ini

© Stack Overflow or respective owner

Related posts about php

Related posts about gzip