|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-15 06:04 UTC] rasmus@php.net
[2005-03-15 08:42 UTC] jmcgutana at alliedbank dot com dot ph
[2005-03-15 08:49 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 17:00:01 2025 UTC |
Description: ------------ I tried using the ZipFile class I found somewhere else to compress files and produce a zip file. But when my input file is larger than 6 megabytes in size, I don't get a zip/compressed file. I debugged the ZipFile class and found out that gzcompress() function doesn't work with a large file e.g. 6 MB file. So, in order to compress my 6 MB file and produce a zip file, I just used the ff. line of code: system("zip $zipfile_name $file_name > /dev/null", $return_val); Reproduce code: --------------- #!/usr/bin/php #phptest.php <?php $file = "ATD335R1.208"; #some file here $fp = fopen($file, "r"); if($fp) { $data = fread($fp, filesize($file)); fclose($fp); } $unc_len = strlen($data); $crc = crc32($data); $zdata = gzcompress($data); #HERE'S WHERE AN ERROR OCCURS print "GZCOMPRESS DONE..".strlen($zdata); ?> Expected result: ---------------- "GZCOMPRESS DONE.." Actual result: -------------- PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6945661 bytes) in /var/www/html/phptest.php on line 17 Content-type: text/html X-Powered-By: PHP/4.3.8