|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-14 21:02 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 03:00:01 2025 UTC |
Description: ------------ victor:~> php -v PHP 5.0.0RC2 (cgi) (built: Apr 30 2004 08:15:25) (oh well, this issue still exists in 5.0.0) victor:~> grep output /usr/local/lib/php.ini <snip> output_buffering = 4096 <snip> output_handler = <snip> zlib.output_compression = Off victor:~> ls -l test.fil -rw-r--r-- 1 root wheel 734939136 Oct 14 2003 test.fil -------------------------------- As the results shows, PHP tries to allocate the whole file in memory which is bad. I thought php_stream_passthru used a small buffer and that it didn't allocate the whole file, but I'm not familiar with the PHP source code. Reproduce code: --------------- <?php readfile("test.fil"); ?> Expected result: ---------------- A lot of file data in the browser window (the file contents) Actual result: -------------- PHP Fatal error: Out of memory: cannot allocate 734941208 bytes! in /usr/home/victor/foo.php on line 2 Content-type: text/html X-Powered-By: PHP/5.0.0RC2 <br /> <b>Fatal error</b>: Out of memory: cannot allocate 734941208 bytes! in <b>/usr/home/victor/foo.php</b> on line <b>2</b><br />