Bug #51079 [Asn->Dup]: fsockopen will not work on 'localhost'

From: Date: Tue, 07 Sep 2010 09:19:04 +0000
Subject: Bug #51079 [Asn->Dup]: fsockopen will not work on 'localhost'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154139@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51079&edit=1

 ID:                 51079
 Updated by:         pajoye@php.net
 Reported by:        tony at marston-home dot demon dot co dot uk
 Summary:            fsockopen will not work on 'localhost'
-Status:             Assigned
+Status:             Duplicate
 Type:               Bug
 Package:            Sockets related
 Operating System:   win32 only - Windows XP
 PHP Version:        5.2.12
 Assigned To:        pajoye
 Block user comment: N

 New Comment:

Fix and discussions will go now into the bug #50963.


Previous Comments:
------------------------------------------------------------------------
[2010-09-07 10:59:53] cataphract@php.net

Oops I hadn't noticed this bug existed and modified #50953 instead.
Sorry.

------------------------------------------------------------------------
[2010-08-25 17:57:19] galatmc at gmail dot com

One small note, if this is of any help.  First, I am new to PHP, and ran
into this same issue with PHPMyAdmin and Drupal.  I am on Windows 7 x64,
and found some info on another site.  However, In my case, I was having
an issue with Drupal trying to check http://family-hp/ (my computer
name).  At the time, my hosts file (c:\windows\system32\etc\hosts)
contained:

127.0.0.1       localhost
::1             localhost

When I ran the script, I received:

called connect('family-hp')
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. 
called connect('localhost')
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. 
called connect('127.0.0.1')
Connected to 127.0.0.1 OK 
called connect('www.tonymarston.net')
Connected to www.tonymarston.net OK 

(note: I added a piece of code to indicate how 'connect' was called.)

I made the following changes to hosts:

1. Added a line for family-hp (not sure why I need this, since IE has no
problem resolving my computer name!).
2. Based on information I found on another site, I commented out the
IPv6 loopback.

New hosts file:

127.0.0.1       family-hp
127.0.0.1       localhost
#::1            localhost

Rerun of script:

called connect('family-hp')
Connected to family-hp OK 
called connect('localhost')
Connected to localhost OK 
called connect('127.0.0.1')
Connected to 127.0.0.1 OK 
called connect('www.tonymarston.net')
Connected to www.tonymarston.net OK 

So, if you give hosts a single choice of IPv4 loopback, and no IPv6
loopback, it works!

Mike

------------------------------------------------------------------------
[2010-05-11 13:41:25] anders at ingemann dot de

I can confirm this on Vista x86 with the precompiled 5.3.2 VC6 ts

------------------------------------------------------------------------
[2010-04-28 00:03:32] jbphp at jlb dot nu

We recently upgraded to PHP 5.3.2 and can replicate this problem under
Windows 7 x64.

Luckily the workaround of using '127.0.0.1' in the fsockopen address
instead of 'localhost' is relatively easy but it broke a large volume of
our existing code. Very annoying.

Please fix this asap.

------------------------------------------------------------------------
[2010-03-13 20:26:19] dontwantanyspam at mailinator dot com

Forgot to mention my operating system. Windows 7 x64.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=51079


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51079&edit=1


Thread (22 messages)

« previous php.bugs (#154139) next »