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

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)    
Comments Add Comment Add patch

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 !
Your email address:
Solve the problem : 22 - 9 = ?

 [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


 [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.