Windows 2008 R2 64-bit, I ‘m facing the strangest problem ever.
My OS is 64-bit, but
PHP are all of 32-bit version. Though
MySQL has official 64-bit version released, but I don’t see any benefit while
PHP have not.
phpMyAdmin is installed and setup, I use Firefox to access it, it took a long time but no response. I read
phpMyAdmin‘s document and it says:
When using the “cookie” authentication method, the mcrypt extension is strongly suggested for most users and is required for 64–bit machines. Not using mcrypt will cause phpMyAdmin to load pages significantly slower.
But I checked and checked and sure that I’ve installed
mcrypt support successfully.
After all, I wrote a very simple test program contains only one line:
The same thing happened again… and the error message says:
Warning: mysql_connect() [function.mysql-connect]:  A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in E:\HTTPD\htdocs\test.php on line 2
Warning: mysql_connect() [function.mysql-connect]: 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. in E:\HTTPD\htdocs\test.php on line 2
Fatal error: Maximum execution time of 30 seconds exceeded in E:\HTTPD\htdocs\test.php on line 2
Here the problem is quite clear:
PHP can’t find localhost server.
And the reason is so simple that
Windows 2008 R2 resolve localhost to
::1: in IPv6 format by default not
127.0.0.1 in IPv4 format, and
PHP is not IPv6 safe. So, connection is always timeout.
Knowing the reason, there is no need for solution any more.