From: andreas dot streichardt at globalpark dot com
Operating system: Linux
PHP version: 5.3.0
PHP Bug Type: Streams related
Bug description: HTTP 1.1 streams painfully slow
Description:
------------
Whenever i try to fetch a file from my server using http 1.1 PHP takes
multiple seconds to load the file. The server is fine. Firefox and curl
load it at no time.
i noticed the same behaviour under PHP 5.2.10 (code a bit different as the
stream_context_set_default is new. But the result is the same.
When i fetch a bigger file i see readfile() hanging somewhere at 90% of
the file but i guess depends on the file ;)
Reproduce code:
---------------
<?php
$default_opts = array(
'http'=>array(
'method'=>"GET",
"protocol_version"=>1.1,
)
);
$default = stream_context_set_default($default_opts);
$start=microtime(true);
readfile("http://minsk/~mop/x");
var_dump(microtime(true)-$start);
Expected result:
----------------
Time needed should be <0.01s
Actual result:
--------------
m...@minsk:~$ time curl http://minsk/~mop/x
LINE 0:
00000000000000000000000000000000000000000000000000000000000000000000000000000000
real 0m0.005s
user 0m0.004s
sys 0m0.000s
m...@minsk:~$ php x.php
LINE 0:
00000000000000000000000000000000000000000000000000000000000000000000000000000000
float(6.0235359668732)
Size doesn't matter it seems. It always hangs!
Output of a manual session:
m...@minsk:~$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /~mop/x HTTP/1.1
Host: minsk
Connection: close
HTTP/1.1 200 OK
Connection: close
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 89
Date: Tue, 21 Jul 2009 15:01:37 GMT
Server: lighttpd/1.4.19
LINE 0:
00000000000000000000000000000000000000000000000000000000000000000000000000000000
Connection closed by foreign host.
nothing fancy there :S
--
Edit bug report at http://bugs.php.net/?id=49004&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49004&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49004&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49004&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49004&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49004&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49004&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49004&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49004&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49004&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49004&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49004&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49004&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49004&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49004&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49004&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49004&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49004&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49004&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49004&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49004&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49004&r=mysqlcfg