0
我有一個53 MB的xml文件,我想要gzip。php gzip xml文件(53MB)casue內存不足錯誤
下面的代碼gzip壓縮它
$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);
這個原因
PHP Fatal error: Out of memory (allocated 70516736) (tried to allocate 24 bytes)
任何一個有任何建議。
我已經有增加php.ini中的內存
我真的不知道該服務器的權限允許我運行exec – ntan 2010-03-29 12:51:58
烤:-)。應該是'gzip output_file.gzip'思想(編輯:哦不,它也適用你的方式,忘記這一點)。然後,只需'readfile('output_file.gzip');'發送適當的gzip頭文件。 –
p4bl0
2010-03-29 12:52:43
「不確定」是否意味着你沒有嘗試過......?先試試然後再評論。 – 2010-03-29 12:53:18