Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.2

Bug #2673 DB::Connect fails to connect to PostgreSQL through UNIX socket.
Submitted: 2004-11-02 15:55 UTC
From: sdubrov at qwest dot com Assigned: danielc
Status: Closed Package: DB
PHP Version: 4.3.9 OS: Solaris 9
Roadmaps: (Not assigned)    
Subscription  


 [2004-11-02 15:55 UTC] sdubrov at qwest dot com
Description: ------------ If DSN is set to something like pgsql://user:password@unix(/tmp/.s.PGSQL.5432)/database DB::Connect fails to connect to database. If it's set to pgsql://user:password@tcp(localhost:5432)/database everything works fine. The bug did not exist in the version 1.5.0RC1. Reproduce code: --------------- $dsn = pgsql://user:password@unix(/tmp/.s.PGSQL.5432)/database; $dbh = DB::connect($dsn); if (DB::isError($dbh)) {die($dbh->getMessage());} Expected result: ---------------- Connect to database. Actual result: -------------- DB Error: connect failed

Comments

 [2004-11-15 08:31 UTC] danielc
I don't have a way to test things on your platform. Please produce a patch that works and I'll be glad to apply it. Thanks.
 [2005-02-15 17:53 UTC] sdubrov at qwest dot com
It turned out that there is nothing wrong with DB module itself. pg_connect function automatically adds socket name to the connect string so one shouldn't pass it with DSN string. Just pass a directory name where PostgreSQL keeps the opened Socket or nothing if it's in the default /tmp. Like that: $dsn = pgsql://user:password@unix(/tmp)/database; $dbh = DB::connect($dsn);
 [2005-02-16 02:03 UTC] danielc
Thanks for following up. I'll add this information to the documentation.