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

 ID:               51759
 Updated by:       and...@php.net
 Reported by:      sed at sed dot is
 Summary:          Same as bug #45150 (localhost -> 127.0.0.1)
-Status:           Open
+Status:           Feedback
 Type:             Bug
 Package:          MySQL related
 Operating System: Windows 7 Ultimate 64bit
 PHP Version:      5.3.2

 New Comment:

Check if this is your case, most probably it is.



http://blogs.iis.net/donraman/archive/2010/06/11/php-5-3-and-mysql-connectivity-problem.aspx


Previous Comments:
------------------------------------------------------------------------
[2010-06-27 13:43:25] therealloonylion at yahoo dot co dot uk

I have the same issue as falcon_ia at hotmail dot com. I upgraded 5.3.0
to 5.3.2 and php is no longer able to connect to Mysql. Mysql is working
fine and my hosts file is correct.

------------------------------------------------------------------------
[2010-05-09 17:46:17] falcon_ia at hotmail dot com

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.

------------------------------------------------------------------------
[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

Reply via email to