#51079 [Opn->Bgs]: fsockopen will not work on 'localhost'
| From: | jani@php.net | Date: | Thu, 18 Feb 2010 11:04:43 +0000 |
| Subject: | #51079 [Opn->Bgs]: fsockopen will not work on 'localhost' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-147821@lists.php.net to get a copy of this message | ||
ID: 51079
Updated by: jani@php.net
Reported By: tony at marston-home dot demon dot co dot uk
-Status: Open
+Status: Bogus
Bug Type: Sockets related
Operating System: Windows XP
PHP Version: 5.2.12
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2010-02-18 10:31:19] tony at marston-home dot demon dot co dot uk
Description:
------------
When are you going to provide a satisfactory answer to bugs
http://bugs.php.net/bug.php?id=50953 and
http://bugs.php.net/bug.php?id=50965? Your only
suggestion has been to
disable IPv^ support in the operating system, but this is a total red
herring.
If IPv6 support is enabled in the operating system it does NOT mean
that only IPv6 addresses are allowed, it means that both IPv5 and IPv6
addresses are supported.
All of my web browsers (IE, Firefox, Opera, Safari) have no problem in
translating 'localhost' to '127.0.0.1'.
The PHP gethostbyname() function has no problem in translating
'localhost' to '127.0.0.1'.
The PHP cURL extension has no problem in translating 'localhost' to
'127.0.0.1'.
fsockopen() when running in PHP 5.3.0 has no problem in translating
'localhost' to '127.0.0.1'.
So why does fsockopen() in php 5.2.12 have a problem?
Reproduce code:
---------------
function connect($host) {
$faultcode = null;
$faultstring = null;
$conn = fsockopen($host, 80, $faultcode, $faultstring, 20);
if (!$conn) {
echo 'faultcode=' .$faultcode .', faultstring=' .$faultstring
."\n";
} else {
echo "Connected to $host OK\n";
} // if
return $conn;
} // function
$result = connect('localhost');
$result = connect('127.0.0.1');
$result = connect('desktop');
$result = connect('www.tonymarston.net');
Expected result:
----------------
I expect to see the message "Connected to <host> OK" for all values of
host.
Actual result:
--------------
Warning: fsockopen(): unable to connect to localhost:80
faultcode=10060, faultstring=A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.
Connected to 127.0.0.1 OK
Connected to desktop OK
Connected to www.tonymarston.net OK
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=51079&edit=1