go to bug id or search bugs for
I've tried to find the solution for this issue here since last month, but if I install any of the recent 5.3 RCs, PHP simply will not talk to the MySQL service.
I upgraded from 5.2.10, and the problem was not present in that version. As far as I recall 5.3.0 and it's RCs did connect but had other issues later resolved.
When I reinstall 5.2.11, everything is back to normal.
I've reproduced this on 3 servers, all running Windows Server 2008.
Bottom line; 5.2.11 can connect and talk to the MySQL service, 5.3.1RC4 can not.
mysql_connect('localhost', 'root', '***');
(After 60 seconds)
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.
Add a Patch
Add a Pull Request
see the other bug report about IPv6 being enabled. Comment out the ::1 line in your hosts file and try again (see the other reports or google about it if you don't know what is it).
Do you mean bug #48805? Anyway, that lin line is already commented out by an '#' in the server's hosts file. It was that way by default.
I can't seem to find the report you're referring to, but the issue still stands. Is it a IPv6 related issue?
The ::1-line in the hosts file is already commented out.
Looking into it further, the comment from pajoye fixes the issue in the vista-based Server 2008. However, Server 2008 R2 is based on Windows 7 and introduces a new feature on the resolving localhost... see from the hosts file:
"localhost name resolution is handled within DNS itself."
So I guess this is a windows bug rather than PHP? I can't see an easy solution here either way.
I mean Bug #45150. But it looks like you may have met another issue. Assigned to the mysql team so they can for more details.
A simple workaround is to uncomment/add this line to the host file:
Worked for me.
> So I guess this is a windows bug rather than PHP?
No, it's a bug in the PHP stream transport. (mysqlnd is using PHP streams for the connection)
If PHP is asking the OS for the IP for the host "localhost", it gets a list with 2 addrinfo structures (one for ::1 and the other for 127.0.0.1), but PHP is only trying a connection to the first one. Well, the MySQL server don't know IPV6, and thus the connection fails.
This bug still exists in the final 5.3.1 release. :-(
Reproduced here using Windows 7 w/ IIS 7.5 (FastCGI is used w/ Non-Thread-Safe php).
The workaround suggested by erik (editing hosts file) works for me.
Btw, PHP 5.3.0 (final) did not have this issue.
I'm having the same issue, along with other problems, trying to upgrade from PHP 5.2 to 5.3 (VC9)
Just tried 5.3.1 on Win2k8_R2 IIS7.5 and I have to change "localhost" to "127.0.0.1" in my scripts even though the hosts file already has the entry 127.0.0.1
Sorry, I seemed to miss the message above about commenting out the "::1" line, which when I did resolved the issue.
Problem only with 5.3.1. No problem with 5.3.0 final.
PHP 5.3.1 does not communicate with MySQL, not with PDO_MySQL through ZendFramework and not with old mysql_ family functions.
For the 1000th time, this is NOT a bug.
Disable IPv6 or do the necessary changes in the hosts file (::1 and other).
edit this file with notepad:
# 127.0.0.1 localhost
# ::1 localhost
# ::1 localhost