[Tickets #10466] Incorrect DSN parameters with PDO for PostgreSQL using Unix sockets

bugs at horde.org bugs at horde.org
Mon Aug 29 00:17:48 UTC 2011


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/10466
------------------------------------------------------------------------------
  Ticket             | 10466
  Created By         | bug-reports at flipjam.co.uk
  Summary            | Incorrect DSN parameters with PDO for PostgreSQL using
                     | Unix sockets
  Queue              | Horde Framework Packages
  Version            | Git master
  Type               | Bug
  State              | Unconfirmed
  Priority           | 1. Low
  Milestone          |
  Patch              | 1
  Owners             |
------------------------------------------------------------------------------


bug-reports at flipjam.co.uk (2011-08-29 00:17) wrote:

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



bug-reports at flipjam.co.uk (2011-08-29 00:17) uploaded: Horde_Db_patches.zip

http://bugs.horde.org/h/services/download/?module=whups&actionID=download_file&file=Horde_Db_patches.zip&ticket=10466&fn=%2FHorde_Db_patches.zip





More information about the bugs mailing list