There's been a long-standing bug with PHP's PDO MySQL driver where the pdo_mysql.default_socket
configuration directive is completely ignored on Unix systems.
Attempting to create a connection using the following:
$db = new PDO('mysql:host=localhost;dbname=test;charset=utf8', 'pdotest', 'pdotest');
Connected to MySQL server version 5.1.37-1ubuntu5.5
Attempting to create a connection using the following:
$sock = ini_get('pdo_mysql.default_socket');
$db = new PDO("mysql:host=localhost;dbname=test;charset=utf8;unix_socket=$sock", 'pdotest', 'pdotest');
Connected to MySQL server version 5.1.37-1ubuntu5.5