From: admin at iut-info dot ens dot univ-reims dot fr
Operating system: HP-UX 11.11
PHP version: 4.3.0
PHP Bug Type: Sockets related
Bug description: fsockopen() : php_network_getaddresses: getaddrinfo failed
The script :
-------------------
$nom="mail";
$adr=gethostbyname($nom);
echo "$nom=$adr<BR />";
$fp=fsockopen ($adr, 110, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
echo fgets ($fp,128) . "<BR />\n";
fputs ($fp, "QUIT\r\n");
echo fgets ($fp,128) . "<BR />\n";
fclose ($fp);
}
?>
----- Result (work's fine) ----------
mail=172.18.1.1
+OK POP3 iut-info v4.41 server ready
+OK Sayonara
------ But if i try (other lines not changed) ------
$fp=fsockopen ($nom, 110, $errno, $errstr, 30);
----- Result ------------
mail=172.18.1.1
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: host nor service provided, or not known in
/home/prof/collet/public_html/testsock.php on line 14
Warning: fsockopen() [function.fsockopen]: unable to connect to mail:110
in /home/prof/collet/public_html/testsock.php on line 14
Protocol not supported (221)
-----------------------------------------------
>From the doc, hostname could be a name, not only a IP.
----- PHP Compile with ---------------
./configure \
--with-oci8 \
--with-apache=../apache_1.3.27 \
--with-gd \
--with-pdflib=/opt/pdflib \
--with-jpeg-dir \
--with-png-dir \
--with-tiff-dir \
--with-zlib \
--with-bz2 \
--enable-sigchild \
--with-mysql=/opt/mysql \
--with-pgsql=/opt/pgsql \
--with-tsrm-pthreads \
--with-dom \
--enable-sockets
------------------------------
Cordialy.
--
Edit bug report at http://bugs.php.net/?id=22302&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22302&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22302&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22302&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22302&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22302&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22302&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22302&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22302&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22302&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22302&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22302&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22302&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22302&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22302&r=gnused