php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34988 PDO_Mysql, hardcoded socket to /tmp/mysql.sock
Submitted: 2005-10-26 10:14 UTC Modified: 2005-10-26 15:55 UTC
From: pookey at pookey dot co dot uk Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.1.0RC3 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
32 - 19 = ?
Subscribe to this entry?

 
 [2005-10-26 10:14 UTC] pookey at pookey dot co dot uk
Description:
------------
This probably shoudln't be filed under this 'type', but 
there's not type of PDO as of yet (#pecl.php EFNet advised 
this was the place to report PDO bugs these days) 
 
There is no way (at least, no documented way) of 
specifying the socket to use to connect to MySQL.  I did 
notice that unix_socket is  used in the C code for the 
module, but I couldn't set this via PHP. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-26 10:56 UTC] tony2001@php.net
Did you try this?
<?php
$pdo = new PDO("mysql:dbname=test;unix_socket=/path/to/socket/mysql.sock"); 
?>
 [2005-10-26 11:05 UTC] pookey at pookey dot co dot uk
Yes, but it didn't work.  Still got an exception: 
Can't connect to local MySQL server though socket '' (2)
 [2005-10-26 15:55 UTC] iliaa@php.net
The socket's default value comes from mysql-config script and only if it is not found does it default to /tmp/mysql.sock.

I've tried Tony's example and it works flawlesly on latest CVS, picking up the unix-domain-socket path provided in the dsn.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC