6.0.0-alpha14
7/3/25

[#10466] Incorrect DSN parameters with PDO for PostgreSQL using Unix sockets
Summary Incorrect DSN parameters with PDO for PostgreSQL using Unix sockets
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester bug-reports (at) flipjam (dot) co (dot) uk
Created 08/29/2011 (5057 days ago)
Due
Updated 09/01/2011 (5054 days ago)
Assigned
Resolved 09/01/2011 (5054 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
09/01/2011 02:24:33 PM Jan Schneider Comment #3
Assigned to Jan Schneider
State ⇒ Resolved
Reply to this comment
The solution was correct and works fine with MySQL.
09/01/2011 02:24:18 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git for this ticket:

[jan] Fix setting unix socket in PostgreSQL DSN 
(bug-reports@flipjam.co.uk, Bug #10466).

  4 files changed, 24 insertions(+), 4 deletions(-)
http://git.horde.org/horde-git/-/commit/7f6e2cf7154531184ad8920d2824e06890035305
08/29/2011 12:17:48 AM bug-reports (at) flipjam (dot) co (dot) uk Comment #1
Priority ⇒ 1. Low
New Attachment: Horde_Db_patches.zip Download
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Incorrect DSN parameters with PDO for PostgreSQL using Unix sockets
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
A fresh install of Horde 4.0.8 & IMP 5.0.10, built from ports on 
FreeBSD 8.1-RELEASE raises the following error when configured to use 
a local PostgreSQL 9.0.4 server as the database, via a Unix socket 
(/tmp/.s.PGSQL.5432):

Could not instantiate PDO with DSN 
"pgsql:dbname=horde;unix_socket=/tmp". PDOException: SQLSTATE[08006] 
[7] invalid connection option "unix_socket"

  1. require() /usr/local/www/horde/imp/index.php:19
  2. Horde_Injector->getInstance() /usr/local/www/horde/imp/mailbox.php:226
  3. Horde_Injector->createInstance() 
/usr/local/share/pear/Horde/Injector.php:248
  4. Horde_Injector_Binder_Factory->create() 
/usr/local/share/pear/Horde/Injector.php:213
  5. Horde_Core_Factory_Token->create() 
/usr/local/share/pear/Horde/Injector/Binder/Factory.php:111
  6. Horde_Injector->getInstance() 
/usr/local/share/pear/Horde/Core/Factory/Token.php:18
  7. Horde_Injector->getInstance() /usr/local/share/pear/Horde/Injector.php:242
  8. Horde_Injector->createInstance() 
/usr/local/share/pear/Horde/Injector.php:248
  9. Horde_Injector_Binder_Factory->create() 
/usr/local/share/pear/Horde/Injector.php:213
10. Horde_Core_Factory_DbBase->create() 
/usr/local/share/pear/Horde/Injector/Binder/Factory.php:111
11. Horde_Core_Factory_Db->create() 
/usr/local/share/pear/Horde/Core/Factory/DbBase.php:17
12. Horde_Core_Factory_Db->createDb() 
/usr/local/share/pear/Horde/Core/Factory/Db.php:95
13. Horde_Db_Adapter_Base->__construct() 
/usr/local/share/pear/Horde/Core/Factory/Db.php:158
14. Horde_Db_Adapter_Pdo_Pgsql->connect() 
/usr/local/share/pear/Horde/Db/Adapter/Base.php:143
15. Horde_Db_Adapter_Pdo_Base->connect() 
/usr/local/share/pear/Horde/Db/Adapter/Pdo/Pgsql.php:88

Checking the docs for PDO with PostgreSQL using Unix sockets suggests 
that the "host" parameter is the mechanism by which the location of 
the socket should be passed; I believe that only MySQL uses 
"unix_socket"...

The attached file contains patches for 
Horde/Db/Adapter/Pdo/(Base|Mysql|Pgsql).php which, for PostgreSQL at 
least, resolves the problem for me by taking the configured value for 
"socket" and using it for "unix_socket" with MySQL or "host" with 
PgSQL. "unix_socket" becomes a MySQL-specific DSN parameter in the 
process. The changes to the MySQL logic are untested.

There may well be a better way of fixing it, but hopefully the patch 
is of some help...

Thanks,

Chris

Saved Queries