Bug #51759 [Com]: Same as bug #45150 (localhost -> 127.0.0.1)
| From: | therealloonylion at yahoo dot co dot uk | Date: | Sun, 27 Jun 2010 11:43:25 +0000 |
| Subject: | Bug #51759 [Com]: Same as bug #45150 (localhost -> 127.0.0.1) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151911@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51759&edit=1
ID: 51759
Comment by: therealloonylion at yahoo dot co dot uk
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:
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.
Previous Comments:
------------------------------------------------------------------------
[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