From: [EMAIL PROTECTED]
Operating system: FreeBSD 4.4
PHP version: 4CVS-2002-10-02
PHP Bug Type: Sockets related
Bug description: fgets taking a long time to return anything
fgets() is taking a VERY long time to return anything with php from cvs
(4.3.0-dev).
Here is a test script to show the behavior:
<?php
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$a = getmicrotime();
$fp = fsockopen('mail.haught.org', 25, $errno, $errstr);
$b = getmicrotime();
echo "(Connected in " .($b-$a). " seconds)<br>";
echo '>' .fgets($fp, 2048);
$c = getmicrotime();
echo " (Read took " .($c-$b). " seconds)<br>";
echo '< EHLO localhost';
fwrite($fp, "EHLO localhost\r\n");
$d = getmicrotime();
echo " (Write took " .($d-$c). " seconds)<br>";
$numlines = 2; //number of lines to read
for ($i; $i<$numlines; $i++) {
echo '>' .fgets($fp, 2048);
$e = getmicrotime();
echo " (Read took " .($e-$d). " seconds)<br>";
}
?>
The Results:
Sept 22nd tree
(Connected in 0.0027800798416138 seconds)
>220 haught.org ESMTP (Read took 0.0082589387893677 seconds)
< EHLO localhost (Write took 0.00019896030426025 seconds)
>250-haught.org (Read took 0.0012670755386353 seconds)
>250-AUTH LOGIN CRAM-MD5 PLAIN (Read took 0.0014160871505737 seconds)
Sept 23rd tree
(Connected in 0.0024210214614868 seconds)
>220 haught.org ESMTP (Read took 60.012040019035 seconds)
< EHLO localhost (Write took 0.00059795379638672 seconds)
>250-haught.org (Read took 60.009819984436 seconds)
>250-AUTH LOGIN CRAM-MD5 PLAIN (Read took 120.02024698257 seconds)
Oct 2nd tree
(Connected in 0.010542035102844 seconds)
>220 haught.org ESMTP (Read took 60.008027911186 seconds)
< EHLO localhost (Write took 0.00064098834991455 seconds)
>250-haught.org (Read took 60.009781002998 seconds)
>250-AUTH LOGIN CRAM-MD5 PLAIN (Read took 120.02020800114 seconds)
I have tried other mail servers with the same result. All trees compiled
with the same configure script. I first noticed this using PEAR's Mail
scripts using smtp.
configure script:
'./configure' \
'--enable-posix' \
'--enable-session' \
'--enable-xml' \
'--enable-inline-optimization' \
'--with-apxs=/home/www/sbin/apxs' \
'--with-config-file-path=/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--enable-track-vars' \
'--with-zlib' \
'--with-gd=/usr/local' \
'--with-pgsql=/usr/local' \
'--with-openssl=/usr' \
'--with-xml=/usr/local' \
'--with-expat-dir=/usr/local' \
'--enable-trans-sid' \
'--with-jpeg-dir=/usr/local' \
'--with-png-dir=/usr/local' \
'--with-freetype-dir=/usr/local' \
'--prefix=/home/www' \
'--enable-gd-native-ttf' \
'--with-pcre-regex' \
'--disable-tokenizer' \
'--disable-ctype' \
'--disable-mbstring' \
'--disable-mbregex' \
'--without-mysql'
Matt
--
Edit bug report at http://bugs.php.net/?id=19722&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19722&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19722&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19722&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19722&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19722&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19722&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19722&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19722&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19722&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19722&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19722&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=19722&r=dst