|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2007-06-30 11:58 UTC] judas dot iscariote at gmail dot com
  [2007-07-03 06:54 UTC] tony2001@php.net
  [2007-07-03 17:34 UTC] champs dot name at gmail dot com
  [2007-07-05 13:56 UTC] tony2001@php.net
  [2007-07-13 01:00 UTC] php-bugs at lists dot php dot net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 09:00:01 2025 UTC | 
Description: ------------ With a client using a 10Mbps connection, it is possible to saturate the pipe using print(fread(...)) in chunks of 32K or larger, but the throughput of fpassthru() and readfile() is consistently ~1/3 of that speed. On the other side of the coin, a client with sub-Mbit DSL is not able to complete 100MB downloads at all, unless readfile/fpassthru() is used. This has been tested in different orders, at different times of day, and on different, non-consecutive days. Reproduce code: --------------- if ($file = fopen($path, $mode)) { $chunk_size = 32; while(!feof($file)) { print(fread($file, $chunk_size * 1024)); if (connection_status() == 0) { flush(); } else { break; } } fclose($file); } Expected result: ---------------- Similar throughput if while() block is replaced with "fpassthru($file)" or "readfile($path)". Actual result: -------------- File is served at over 900kB/s with fread(), less than 300kB/s with fpassthru/readfile().