ZF-1914: Support unix_socket option for Pdo MySQL adapter

Description

There is currently no way to specify the unix_socket option for the PDO_MYSQL DSN. See http://php.net/manual/en/…

The desired usage is:


$driver_options = array('unix_socket' => '/path/to/mysql.sock');
$params = array('driver_options' => $driver_options, ...other options...);
$db = Zend_Db::factory('pdo_mysql', $params);

The MySQLI extension doesn't need any change, because the socket location is specified in a php.ini configuration.

Comments

this already works, but you specify it in the options, not the driver_options...


$options = array(
    'host'        => 'localhost',
    'username'    => 'user',
    'password'    => '****',
    'dbname'      => 'db',
    'unix_socket' => '/tmp/mysql5.sock'
    );
$db = Zend_Db::factory('Pdo_Mysql', $options);

This issue should have been fixed for the 1.5 release.

Please categorize/fix as needed.

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

[~mc] claims that the {{unix_socket}} option is already configurable; please reopen if this is not the case.

I have confirmed with the 1.5 code at least that Marc Boeren's suggestion works. I have this in my config.ini file

[dev] database.params.host=localhost database.adapter=pdo_mysql database.params.username=root database.params.password="" database.params.dbname=test database.params.unix_socket="/var/run/mysqld/mysqld.sock"

and I'm now able to use the PDO driver.