Menu

PDO could not construct

Help
2009-08-20
2013-05-30
  • Nicolas Bourré

    Nicolas Bourré - 2009-08-20

    Hi,
    I'm trying to run phpgedview, but there seem to have a problem with pdo.

    I always get this error :
    PHP Warning:  PDO::__construct() [<a href='pdo.--construct'>pdo.--construct</a>]: [2002] A connection attempt failed because the connected party did not  (trying to connect via tcp://localhost:0) in C:\Inetpub\wwwroot\genealogy\includes\classes\class_pgv_db.php on line 122

    Can someone give me a hand on this problem?

     
    • Anonymous

      Anonymous - 2009-08-20

      It could be a number of things. Can you give us more information...

      What version of PGV?
      What database (tyupe and version)?
      What version of PHP?
      Are PDO drivers installed AND enabled on your server?

      When you say "trying to run phpgedview" - please clarify. How far have you got, fully installed, unable to install, are you upgrading, etc...

       
      • stha68

        stha68 - 2009-08-20

        changing port in config.php solved this for me today.
        $DBPORT='3306'; //-- Database port, leave blank for default

         
    • Mark Hattam

      Mark Hattam - 2009-08-20

      I got that error when I tried php 5.3 on my XP machine with MySQL 5.0.84 ... going back to php 5.2.10 made it all work again. (According to phpinfo I did have PDO enabled etc, but the MySQL libraries appear very old)

      I'd be interested to see what php you're running on your presumably Windoze system.

       
    • Mark Hattam

      Mark Hattam - 2009-08-21

      Aha ... specifying 3306 in $DBPORT made it work for me too. Leaving it blank for default doesn't let it work.

      config.dist (and hence config.php) has
      $DBTYPE = "mysql";                                //-- type of database to connect when using the PEAR:DB module
      $DBHOST = "localhost";                            //-- Host where MySQL database is kept
      $DBPORT = "";                                    //-- Database port, leave blank for default

      As we're now using PDO and not PEAR ... and there's also mysqlnd (not just mysql or mysqli) ... does the $DBPORT have to be explicitly specified here now?

      Mark

       
      • Anonymous

        Anonymous - 2009-08-21

        "does the $DBPORT have to be explicitly specified here now? "

        Not very everyone Mark. My entry for that is still the same as its always been - blank.

         
    • Mark Hattam

      Mark Hattam - 2009-08-21

      Maybe just php 5.3 on Windows ... 5.2.10 seemed to manage fine using mysqli and no need to specify ... 5.3 uses mysqlnd and it appears to need specifying.

      My Mac is running php 5.3 but using mysqli not mysqlnd and it's still a blank config item for $DBPORT.

       
    • Greg Roach

      Greg Roach - 2009-08-22

      I've just upgraded to the latest XAMPP (PHP5.3.0 on windows), and I don't see any of these problems.  Everything just carried on working....

       
    • Mark Hattam

      Mark Hattam - 2009-08-27

      just found this bug report on php.net which lays the blame at mysqlnd ... if you're using mysql or mysqli you're fine, if you're using mysqlnd you're not *unless* you explicitly set the port.

      http://bugs.php.net/bug.php?id=45468

      So it's not just "php5 on windows", it's whether it has mysqlnd as the default, and if so whether the socket has been defined or not. (with mysql and mysqli you didn't need to set it explicitly). Maybe XAMPP is smoothing over the process by doing it itself (or not using mysqlnd).

      Mark

       
    • Anonymous

      Anonymous - 2009-08-27

      This is well outside my "comfort zone" . expertise, but have just read this blog: http://blog.ulf-wendel.de/?p=149 .

      As PGV now uses PDO extensively, this seems to imply that we should be instructing installers to ensure mysqlnd is NOT used. Is that a correct reading? It does say "PDO/MySQL does not support mysqlnd".

       
    • Mark Hattam

      Mark Hattam - 2009-08-27

      If you're compiling on a PowerPC Mac mysqlnd also fails to build
      http://bugs.php.net/bug.php?id=48198

      But on Intel Macs it's fine.

      My iMac here is running mysqlnd with php5.3 and inherently pdo and it's been fine since the outset with pgv 4.2.2. (It wasn't with pgv 4.2.1 though).

      Upgrading to php5.3 on XP though failed to make db connections, and it seems to catch nearly everyone.

      Most PGV users on shared hosts won't get the choice of "with pdo" and/or "without mysqlnd" ...  it's putting a huge burden on people to try and work out whether their host which has been fine thus far up to pgv 4.2.1 now will work or not.

       

Log in to post a comment.