#19886 [Fbk->NoF]: readfile, fread, fpassthru won't work with large files!!!

From: Date: Sat, 16 Nov 2002 07:00:05 +0000
Subject: #19886 [Fbk->NoF]: readfile, fread, fpassthru won't work with large files!!!
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-25040@lists.php.net to get a copy of this message
 ID:               19886
 Updated by:       php-bugs@lists.php.net
 Reported By:      spic@php.net
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         Filesystem function related
 Operating System: Windows, any Version
 PHP Version:      4CVS-2002-10-13
 New Comment:

No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".


Previous Comments:
------------------------------------------------------------------------

[2002-10-31 07:59:35] wez@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.



------------------------------------------------------------------------

[2002-10-31 07:01:23] spic@php.net

The problem can be reproduced using Apache/Win32 using the script
posted at 13 Oct 10:19am.

I tried the newest snapshot (31-Oct-2002 03:28). Furthermore, the
previous snaps and different release versions (>4.2.2) don't work. I
deleted versions < 4.2.1, so I can't test them any more.



------------------------------------------------------------------------

[2002-10-31 05:17:56] harbater@teamgenesis.com

I'm experiencing something similar on Linux Apache using Version 4.1.2.
 As far as I know it worked before I upgraded from an earlier version.


My code looks like this:

$file="/path/to/file"; 
$fp  = fopen($file, "r");

$size=filesize($file);

$contents = fread($fp, $size);
fclose($fp);

Header("Content-Type: $type");
Header("Content-Disposition: attachment; filename=$downloadname");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary");
echo $contents;


filesize() is reporting the size properly.  The code works perfectly
for smaller files, but the fread() fails for files larger than 19 MB or
so and I got a page cannot be displayed error.  All the files being
downloaded are PDF files.

------------------------------------------------------------------------

[2002-10-31 04:34:57] selfman@lasercat.de

None of them has been used (output buffering or ob_gzhandler, or
zlib.output_compression or transparent SID/session rewriting). The
fopen() -> $val = fread()-> echo $val worked fine. The response was
much quicker.
Never minad... I have solved the problem otherwise. And the data have
moved to a differen server with higher capacity.

Regards SelfMan

------------------------------------------------------------------------

[2002-10-29 19:13:28] wez@php.net

and did you try the most recent snapshot as I suggested
on the 13 Oct?
And could you reproduce the issue using a different web server?

------------------------------------------------------------------------

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
    http://bugs.php.net/19886

-- 
Edit this bug report at http://bugs.php.net/?id=19886&edit=1



Thread (21 messages)

« previous php.bugs (#25040) next »