Php 5.3.3 Upgrade, Mysql 5 Connection Problem Solved
by David Joly | Wednesday, September 1st, 2010Today I decided to upgrade PHP on my Windows 7 64-bit development machine. I downloaded PHP 5.3.3, configured it, made sure my environment variables were all good, installed pear, xdebug, and phpunit. Everything looked good, so I fired up Apache, and went back to work. BAM! I get the following error:
PDO::__construct() [pdo.--construct ]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306)
PHP can no longer connect to MySQL. Say what?! After an hour or so searching Google and experimenting, I found something that worked.
For some reason MySQL does not listen to localhost. To fix the problem, I simply changed my scripts’ connection host parameters to “127.0.0.1″. I can thank the post http://coreygilmore.com/blog/2009/11/20/fix-php-5-3-hang-on-windows/ by Corey Gilmore for that little detail. Although, it was working perfectly fine with PHP5.3.0, so overall I am stumped.