ID: 50357 Updated by: ras...@php.net Reported By: ghxter at gmail dot com -Status: Open +Status: Feedback Bug Type: PDO related Operating System: Windows 7 X86 PHP Version: 5.3.1 New Comment:
Is this the ipv6 localhost problem again? Does connection to 127.0.0.1 instead of localhost work? If so, add an ipv4 entry for localhosts to your hosts file. Previous Comments: ------------------------------------------------------------------------ [2010-01-30 03:39:48] richardcpelletier at gmail dot com I am using Vista Home x64 and I am encountering this problem as well. I have disabled all firewalls and I had no difficulty with PHP 5.2. ------------------------------------------------------------------------ [2009-12-02 05:52:09] ghxter at gmail dot com More Info: PHP Warning: PDO::__construct(): [2002] ÓÉÓÚÁ¬½Ó·½ÔÚÒ»¶Îʱ¼äºóûÓÐÕýÈ·´ð¸´»òÁ¬½ÓµÄÖ÷»úûÓз´Ó¦£¬Á¬½Ó³¢ÊÔ (trying to connect via tcp://localhost:3306) in D:\WebSites\test.php on line 6 ------------------------------------------------------------------------ [2009-12-02 05:50:03] ghxter at gmail dot com Description: ------------ Mysql Code: try{ $dbh = new PDO('mysql:host=localhost;dbname=test', 'root', ''); var_dump($dbh); } catch(Exception $e) { echo $e->getMessage(); } Error Info: SQLSTATE[HY000] [2002] ÓÉÓÚÁ¬½Ó·½ÔÚÒ»¶Îʱ¼äºóûÓÐÕýÈ·´ð¸´»òÁ¬½ÓµÄÖ÷»úûÓз´Ó¦£¬Á¬½Ó³¢ÊÔʧ°Ü¡£ Env: Windows7x86 + Mysql5.1.41 + nginx0.7.63. I tested from php5.2.6 to php.5.2.11 And php5.3.0 are work. but php.5.3.1 and php.5.3.2 are not work. Reproduce code: --------------- try{ $dbh = new PDO('mysql:host=localhost;dbname=test', 'root', ''); var_dump($dbh); } catch(Exception $e) { echo $e->getMessage(); } Expected result: ---------------- ---------- PHPTest ---------- object(PDO)#1 (0) { } Actual result: -------------- ---------- PHPTest ---------- SQLSTATE[HY000] [2002] ÓÉÓÚÁ¬½Ó·½ÔÚÒ»¶Îʱ¼äºóûÓÐÕýÈ·´ð¸´»òÁ¬½ÓµÄÖ÷»úûÓз´Ó¦£¬Á¬½Ó³¢ÊÔʧ°Ü¡£ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50357&edit=1