|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41166 fpassthru and the other read-Funktions are very very slow
Submitted: 2007-04-22 20:18 UTC Modified: 2007-04-22 21:20 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: alex dot taeffner at vr-web dot de Assigned:
Status: Not a bug Package: Sockets related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: alex dot taeffner at vr-web dot de
New email:
PHP Version: OS:


 [2007-04-22 20:18 UTC] alex dot taeffner at vr-web dot de
Every Function which reads the answar of a TCP-Server Completely (since the last read (Pointer-Position to EOF)) hangs very long while executing the script.

fputs($TS_link, "help\n");

If I write

print fread($TS_link, 1024);

The Script returns the LAST line: OK

If I write


The Script loads more than a minute and returns ALL LINES since the last read.
It doesnt matter if there are yust two lines or een one line or if there are 100 lines to read.

Even if I write
while (!feof($TS_link)) {
print fgets($TS_link);


while (!feof($TS_link)) {
print fread($TS_link);

It is the same Problem.
It occurs whith every possibility.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-22 20:55 UTC] alex dot taeffner at vr-web dot de
I've just found out another thing:

If I close the TCP-Connection (Telnet) before I use the command it works fine.

I mean it like that:

fputs($TS_link, "dbuserid 2\n");
fputs($TS_link, "quit\n");
while(!feof($TS_link)) {
     $out .= fgets($TS_link, 1024);
print $out;

Works fine!


fputs($TS_link, "dbuserid 2\n");
while(!feof($TS_link)) {
     $out .= fgets($TS_link, 1024);
print $out;

lasts very verry long!

My big problem:
I cannot quit before I have read it because I want to read a value of the answer and use it in the next query.
Is there another way?
 [2007-04-22 21:20 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The long time for the original code is obviously a result of running into a timeout, which has nothing to do with PHP. It appears you need to figure out how the protocol tells you when the answer is sent out completely. This has nothing to do with PHP at all.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 21:03:35 2022 UTC