php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40279 fsockopen broken on IPv6
Submitted: 2007-01-29 22:02 UTC Modified: 2009-06-13 16:33 UTC
Votes:6
Avg. Score:4.0 ± 1.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: SiliconFiend at gmail dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 5.2.0 OS: Windows XP SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: SiliconFiend at gmail dot com
New email:
PHP Version: OS:

 

 [2007-01-29 22:02 UTC] SiliconFiend at gmail dot com
Description:
------------
Bug #30057 seems to have regressed. On Windows, when IPv6 is enabled, [::1] is returned as the first address for localhost, so using localhost exhibits the same problem.

Other info: Using PHP 5.2.0 in mod_php with Apache 2.2.3 which was included with XAMPP; IPv6 Support is reported as enabled in phpinfo(). Apache displays page when http://[::1]/ is entered in Firefox, so Apache is responding to IPv6 requests on port 80.


Reproduce code:
---------------
$handle = fsockopen('[::1]', 80, $errno, $errstr, 5);
if (empty($handle)) {
    echo 'Error ' . $errno . ': ' . $errstr . '<br/>';
    exit("Can't open socket");
}
Or use the reproduce code in #30057.

Expected result:
----------------
No error.

Actual result:
--------------
Warning: fsockopen() [function.fsockopen]: unable to connect to [::1]:80 (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. )
Error 10060: 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.
Can't open socket

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-30 09:02 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2007-01-30 18:33 UTC] SiliconFiend at gmail dot com
Same result with the CVS snapshot. I tried both php.ini-dist and php.ini-recommended files for the php.ini. The only difference is that php.ini-recommended didn't display the errors. One note, though, probably unrelated--using the php5apache2.dll module file from this snapshot did not allow the server to start--nothing in the error log; it just immediately stopped after attempting to start it. I had been using the php5apache2.dll with the PHP version 5.2.0 distributed with XAMPP. This was the default configuration; I don't know why they didn't use 2_2. Anyway, changing the LoadModule directive to point to php5apache2_2.dll allowed the server to start.
 [2007-02-01 06:15 UTC] SiliconFiend at gmail dot com
I should be more clear. Using php.ini-recommended suppressed the php warning/error output, but the error still occurred.
 [2007-02-12 19:16 UTC] tony2001@php.net
How exactly did you enable IPv6 support in your Windows?

>when http://[::1]/ is entered in Firefox, so Apache
>is responding to IPv6 requests on port 80.

Try using this address in telnet and MSIE.
Do they work too?
 [2007-02-17 17:31 UTC] SiliconFiend at gmail dot com
I think I installed IPv6 on Windows using the "Install..."->Protocol function on the Properties window for my network connection. You can also open a command window and type "ipv6 install" to accomplish the same thing.

Internet Explorer can't handle IPv6 literal addresses (such as [::1]) in the URL. See http://blogs.msdn.com/ie/archive/2006/12/06/file-uris-in-windows.aspx

Unfortunately, in an effort to work around this problem, I made some changes to my IPv6 configuration and now Apache is no longer binding to my IPv6 address, so I can't display a page even in Firefox right now. I'm trying to fix it.
 [2007-03-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-04-28 17:48 UTC] giunta dot gaetano at gmail dot com
Very weird, this started happening to me, too.

Symptoms:
+ ping 'localhost' returns ::1
+ using "telnet localhost 80" works, ie apache responds ok
+ php fsockopen(localhost) stalls, plus apache show no access logs, nor etheral captures any packets on any nic

How ipv6 got enabled is a mystery to me. It is explicitly disabled on ALL network connections I have in use. All I did today was enabling the wifi nic (intel 2200) to connect to my new home lan... Maybe the dns server is broadcasting ipv6 addresses for localhost (wtf) ??? I tried ipconfig /flushdns to no avail. No trace of ::1 in etc/hosts either...

btw, ipconfig /displaydns shows:

         5.64.3.10.in-addr.arpa
         ----------------------------------------
         Nome record . . . . . : 5.64.3.10.in-addr.arpa.
         Tipo record . . . . . : 12
         Durata (TTL). . . . . : 0
         Lunghezza dati. . . . : 4
         Sezione . . . . . . . : Risposta
         Record PTR  . . . . . : srvmappemxp


         1.0.0.127.in-addr.arpa
         ----------------------------------------
         Nome record . . . . . : 1.0.0.127.in-addr.arpa.
         Tipo record . . . . . : 12
         Durata (TTL). . . . . : 0
         Lunghezza dati. . . . : 4
         Sezione . . . . . . . : Risposta
         Record PTR  . . . . . : localhost


         srvmappemxp
         ----------------------------------------
         Nome record . . . . . : srvmappemxp
         Tipo record . . . . . : 1
         Durata (TTL). . . . . : 0
         Lunghezza dati. . . . : 4
         Sezione . . . . . . . : Risposta
         Record A (Host) . . . : 10.3.64.5


         localhost
         ----------------------------------------
         Nome record . . . . . : localhost
         Tipo record . . . . . : 1
         Durata (TTL). . . . . : 0
         Lunghezza dati. . . . : 4
         Sezione . . . . . . . : Risposta
         Record A (Host) . . . : 127.0.0.1
 [2009-06-13 16:02 UTC] ray at kristenandray dot net
I'm experiencing this issue as well. Anything I can do to help someone look into it?

System:
OS: Windows Vista Home Premium x64
PHP: Precompiled v5.2.8
Server: MS Expression Web 2 Development Server (Cassini?)

Not sure if it matters, but configuration of the integrated server in Expression web requires using php-cgi.exe, rather than php.exe

It would be nice to get this fixed...
 [2009-06-13 16:33 UTC] pajoye@php.net
::1 being resolved as 1st address is not a php problem. See the other localhost with IPv6 issues for an explanation and how to work around this problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 09:01:31 2024 UTC