Zend Framework

Support unix_socket option for Pdo MySQL adapter

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 1.0.1
  • Fix Version/s: None
  • Component/s: Zend_Db
  • Labels:
    None
  • Fix Version Priority:
    Should Have

Description

There is currently no way to specify the unix_socket option for the PDO_MYSQL DSN.
See http://www.php.net/manual/en/ref.pdo-mysql.connection.php

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.

Issue Links

Activity

Hide
Marc Boeren added a comment -

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);
Show
Marc Boeren added a comment - 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);
Hide
Wil Sinclair added a comment -

This issue should have been fixed for the 1.5 release.

Show
Wil Sinclair added a comment - This issue should have been fixed for the 1.5 release.
Hide
Wil Sinclair added a comment -

Please categorize/fix as needed.

Show
Wil Sinclair added a comment - Please categorize/fix as needed.
Hide
Wil Sinclair added a comment -

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

Show
Wil Sinclair added a comment - This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.
Hide
Darby Felton added a comment -

Marc Boeren claims that the unix_socket option is already configurable; please reopen if this is not the case.

Show
Darby Felton added a comment - Marc Boeren claims that the unix_socket option is already configurable; please reopen if this is not the case.
Hide
Jim Plush added a comment -

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.

Show
Jim Plush added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified