Bug #51759 [Com]: Same as bug #45150 (localhost -> 127.0.0.1)
Edit report at http://bugs.php.net/bug.php?id=51759&edit=1
ID: 51759
Comment by: falcon_ia at hotmail dot com
Reported by: sed at sed dot is
Summary: Same as bug #45150 (localhost -> 127.0.0.1)
Status: Open
Type: Bug
Package: MySQL related
Operating System: Windows 7 Ultimate 64bit
PHP Version: 5.3.2
New Comment:
After I updated php from 5.3.0 to 5.3.2,
mysql_connect cannot connect localhost but 127.0.0.1.
It shows:
Warning: mysql_connect() [function.mysql-connect]: [2002] A connection
attempt failed because the connected party did not (trying to connect
via tcp://localhost:3306) in ........
And drivers\etc\hosts seems good.
Previous Comments:
------------------------------------------------------------------------
[2010-05-06 21:43:33] sed at sed dot is
Description:
------------
Same as bug #45150. I was not able to connect to MySQL via localhost
though PHP found the mysql extension etc.
Finally, after 20 hours work, I found a website through Google that let
me to a solution. To fix this I'll have to use "127.0.0.1" instead of
"localhost"
I'm using IIS7.5 on Windows 7 Ultimate 64bit
FastCGI (PHP 5.2.13 installer [20,929Kb] - 25 February 2010, md5:
891e3262428851ebe71d5432a97be6d5, with my own php.ini aftertouch)
MySQL 5.1.46-winx64
Using both IPv4 and IPv6
I can use localhost within MySQL command prompt, but not with PHP.
Test script:
---------------
// timeout
$host = "localhost";
$user = "root";
$password = "******";
$database = "******";
$mysql_link = mysql_connect( $host, $user, $password );
// timeout fixed
$host = "127.0.0.1";
$user = "root";
$password = "******";
$database = "******";
$mysql_link = mysql_connect( $host, $user, $password );
Expected result:
----------------
Normal connection with mysql without timeout.
Actual result:
--------------
Timeout trying to connect via mysql_connect (Error: 2002)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51759&edit=1
Thread (5 messages)