From: scouture at novo dot ca
Operating system: win2000
PHP version: 4.3.3
PHP Bug Type: Performance problem
Bug description: enormus time get result from fgets via fsocketopen
Description:
------------
I was using php 4.2.2 before updating to 4.3.3.
I have to talk to another application server using socket.
With 4.2.2, i had my response in less than a second but it take me about
60 sec with php 4.3.3
Reproduce code:
---------------
function getFromSocket($message){
set_time_limit (0);
$res = @fsockopen ("192.168.10.5", "3734", $errno, $errstr,30);
if(!$res) {
exit; //some eror...
}
else{
fputs($res, $message);
//samething, reponding server end the response by SCKEND
// while (substr_count($buff, "SCKEND")!= 1)
while ($bytes != "0"){
$buff .= fgets($res,4096);
//$array_statusSocket = socket_get_status($res); //for 4.2.2
$array_statusSocket = stream_get_meta_data($res);
$bytes = $array_statusSocket["unread_bytes"];
}
fclose ($res);
}
return $buff;
}
function getMicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_requete = getMicrotime();
$str_resultatSocket =
getFromSocket("LOG|novojustice|justicenovo|intranet||SCKEND");
$time_requete2 = getMicrotime();
echo $time_requete2-$time_requete ." time<hr>";
exit;
Expected result:
----------------
have the result more quickly
Actual result:
--------------
took about 60sec..
--
Edit bug report at http://bugs.php.net/?id=25828&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25828&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25828&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25828&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25828&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25828&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25828&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25828&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25828&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25828&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25828&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25828&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25828&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25828&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25828&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25828&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25828&r=float