From: jmcgutana at alliedbank dot com dot ph Operating system: Linux Fedora Core PHP version: 4.3.8 PHP Bug Type: Zlib Related Bug description: gzcompress() function doesn't work on a large file
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 -- Edit bug report at http://bugs.php.net/?id=32306&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32306&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32306&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32306&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32306&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32306&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32306&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32306&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32306&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32306&r=support Expected behavior: http://bugs.php.net/fix.php?id=32306&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32306&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32306&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32306&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32306&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32306&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32306&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32306&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32306&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32306&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32306&r=mysqlcfg