#50965 [NEW]: fsockopen will not work on 'localhost'
| From: | tony at marston-home dot demon dot co dot uk | Date: | Mon, 08 Feb 2010 11:06:37 +0000 |
| Subject: | #50965 [NEW]: fsockopen will not work on 'localhost' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-147316@lists.php.net to get a copy of this message | ||
From: tony at marston-home dot demon dot co dot uk
Operating system: Windows XP
PHP version: 5.2.12
PHP Bug Type: Sockets related
Bug description: fsockopen will not work on 'localhost'
Description:
------------
When are you going to provide a proper answer for post
http://bugs.php.net/bug.php?id=50953 ? I have
removed the IPv6 entries in
my hosts file, but the problem is still there.
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 bug report at http://bugs.php.net/?id=50965&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50965&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50965&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50965&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50965&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50965&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50965&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50965&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50965&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50965&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50965&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50965&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50965&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50965&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50965&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50965&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50965&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50965&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50965&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50965&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50965&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50965&r=mysqlcfg