ZF-1914: Support unix_socket option for Pdo MySQL adapter

Issue Type: Improvement Created: 2007-09-06T13:59:32.000+0000 Last Updated: 2010-11-25T01:00:46.000+0000 Status: Resolved Fix version(s): Reporter: Bill Karwin (bkarwin) Assignee: Darby Felton (darby) Tags: - Zend_Db

Related issues: - ZF-4773



There is currently no way to specify the unix_socket option for the PDO_MYSQL DSN. See…

The desired usage is:

<pre class="highlight">
$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.


Posted by Marc Boeren (mc) on 2007-11-07T10:42:01.000+0000

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

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

Posted by Wil Sinclair (wil) on 2008-03-21T17:05:27.000+0000

This issue should have been fixed for the 1.5 release.

Posted by Wil Sinclair (wil) on 2008-03-25T20:43:55.000+0000

Please categorize/fix as needed.

Posted by Wil Sinclair (wil) on 2008-04-18T13:12:01.000+0000

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

Posted by Darby Felton (darby) on 2008-04-24T16:03:06.000+0000

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

Posted by Jim Plush (jplush76) on 2008-06-18T20:35:01.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.