Edit report at https://bugs.php.net/bug.php?id=61636&edit=1
ID: 61636 Updated by: paj...@php.net Reported by: kontrollfreak at arcor dot de Summary: readfile() resp. fpassthru() try to allocate complete file into memory -Status: Open +Status: Feedback Type: Bug Package: Apache related Operating System: Windows XP SP3 PHP Version: master-Git-2012-04-05 (snap) Block user comment: N Private report: N New Comment: And you still got the out of memory error? Previous Comments: ------------------------------------------------------------------------ [2013-04-14 13:59:28] kontrollfreak at arcor dot de In reply to [2013-04-14 12:55 UTC] paj...@php.net: During the test output buffering was disabled by the following snippet. Disable output buffering: ------------------------- <?php while (ob_get_level()) ob_end_flush(); ?> ------------------------------------------------------------------------ [2013-04-14 12:55:29] paj...@php.net Be sure to disable output buffering, see http://www.php.net/readfile ------------------------------------------------------------------------ [2013-04-14 11:18:29] kontrollfreak at arcor dot de (Windows only) kv3981 at gmail dot com's solution works as long as the transfer does not take longer than max_execution_time. ------------------------------------------------------------------------ [2013-02-10 20:00:53] fredericg_99 at yahoo dot fr I can confirm that the problem exists on PHP 5.3.16. However, the problem does not appear for every files, but once it appears on a file, it applies for every attempts on that file (and not necessarily for the others). The proposed workaround works. ------------------------------------------------------------------------ [2012-11-09 23:52:20] kv3981 at gmail dot com Same issue on -------------- - Debian Squeeze 6.0.6 - PHP 5.3.3-7+squeeze14 - Default php.ini, with memory_limit 128M 128M Workaround ----------- <?php // Reads large file, fixes: https://bugs.php.net/bug.php?id=61636 function readlargefile($fullfile) { $fp = fopen($fullfile, 'rb'); if ($fp) { while (!feof($fp)) { print(fread($fp, 2097152)); } fclose($fp); } } ?> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=61636 -- Edit this bug report at https://bugs.php.net/bug.php?id=61636&edit=1