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