php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50357 PDO_Mysql Not work.
Submitted: 2009-12-02 05:50 UTC Modified: 2013-02-18 00:34 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: ghxter at gmail dot com Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.3.1 OS: Windows 7 X86
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
21 - 8 = ?
Subscribe to this entry?

 
 [2009-12-02 05:50 UTC] 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] ???????ӷ???һ??ʱ????û????ȷ??????ӵ?????û?з?Ӧ?????ӳ???ʧ?ܡ?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-02 05:52 UTC] 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
 [2010-01-30 03:39 UTC] 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.
 [2010-01-30 03:46 UTC] rasmus@php.net
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.
 [2010-02-07 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-25 20:42 UTC] felipe@php.net
-Status: No Feedback +Status: Feedback
 [2010-04-25 20:42 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 03:01:32 2024 UTC