Edit report at http://bugs.php.net/bug.php?id=51079&edit=1
ID: 51079
Comment by: anders at ingemann dot de
Reported by: tony at marston-home dot demon dot co dot uk
Summary: fsockopen will not work on 'localhost'
Status: Assigned
Type: Bug
Package: Sockets related
Operating System: win32 only - Windows XP
PHP Version: 5.2.12
Assigned To: pajoye
New Comment:
I can confirm this on Vista x86 with the precompiled 5.3.2 VC6 ts
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2010-03-13 20:22:24] dontwantanyspam at mailinator dot com
I can also confirm that this problem isn't there in PHP 5.3.0. Its there
since
5.3.1.
Unlike PHP 5.3.0, a 64 bit version of PHP 5.3.1 wasn't available at
http://windows.php.net/qa/, so I tried compiling it
myself. After
compiling I
noticed that a script that uses
file_get_contents("http://localhost/...")
wouldn't work until I change the "localhost" to "127.0.0.1". I didn't
care about
it much at that time since it seemed like a small problem. But then I
noticed
that none of the scripts that used mysql were working. I even tried to
log in to
phpMyAdmin and even that didn't work (same problem described by
thijsputman). So
I thought that it was probably a bug with the 64 bit binary and
continued using
PHP 5.3.0.
But after PHP 5.3.2 was released, I tried compiling it also and noticed
that the
problem was still there. Thinking that it may be related to mysqlnd
since the
version used by PHP 5.3.0 is 5.0.5-dev and the one used by PHP 5.3.2 is
5.0.7-
dev, I tried compiling the mysql, mysqli and pdo mysql extensions with
libmysql.
I has success with the mysql extension only. The mysqli and pdo mysql
extension
failed to compile with libmysql (there were a lot of build errors).
Anyway, I
tried the mysql extension compiled with libmysql and noticed that it was
working
fine! But I needed the mysqli extension to work also and since it failed
to
compile with libmysql, I messed around some more and finally realized
that it
was the same problem as with the file_get_contents. So I tried changing
all the
"localhost" references to "127.0.0.1" and it worked!
Anyway, for whatever reason the mysql extension compiled with libmysql
works
fine with "localhost" but the one compiled with mysqlnd doesn't. So, I
hope this
helps you to find and squish the bug thats causing this. :D
------------------------------------------------------------------------
[2010-03-10 12:31:15] thijsputman at gmail dot com
Fair enough :)
The reproduce code provided fails to connect to "localhost" with
fsockopen() in PHP 5.3.2. When using PHP 5.3.0 fsockopen() connects to
"localhost" without problems.
------------------------------------------------------------------------
[2010-03-10 12:03:59] pajoye@php.net
It does not depend on PHP only but libmysql or mysql server. Please keep
posting about the socket issue only here as the myslq&IPv6 questions
have been covered numerous times in other reports. The one report per
issue rule is also a good way to do not get distracted, thanks for your
understanding :)
------------------------------------------------------------------------
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