php.net |  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
Votes:1
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
10 + 8 = ?
Subscribe to this entry?

 
 [2007-04-22 20:18 UTC] alex dot taeffner at vr-web dot de
Description:
------------
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");

Well...
If I write

print fread($TS_link, 1024);

The Script returns the LAST line: OK

If I write

fpassthru($TS_link);

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);
}

or 

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

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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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!

BUT

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] helly@php.net
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 http://www.php.net/support.php 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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC