php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50829 php.ini directive pdo_mysql.default_socket is ignored
Submitted: 2010-01-24 14:03 UTC Modified: 2010-01-26 13:15 UTC
From: giovanni at giacobbi dot net Assigned:
Status: Closed Package: PDO related
PHP Version: 5.3.2RC1 OS: Linux
Private report: No CVE-ID: None
 [2010-01-24 14:03 UTC] giovanni at giacobbi dot net
Description:
------------
The php.ini pdo_mysql.default_socket seems to be ignored.

see related (closed) bug #49306


Reproduce code:
---------------
php -d pdo_mysql.default_socket=ciao -r 'var_dump(ini_get("pdo_mysql.default_socket"));'


Expected result:
----------------
string(4) "ciao"


Actual result:
--------------
bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-26 13:15 UTC] svn@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=294040
Log: Fixed bug #50829 (php.ini directive pdo_mysql.default_socket is ignored)
 [2010-01-26 13:15 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2010-02-03 21:00 UTC] svn@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=294469
Log: Fixed bug #50829 (php.ini directive pdo_mysql.default_socket is ignored)
 [2010-03-24 17:49 UTC] paul at boxuk dot com
this, or a problem relating to this fix appears to be seg-faulting the pdo_mysql 
module on startup in ZTS mode

bug #51216 is related

commenting out REGISTER_INI_ENTRIES() in ext/pdo_mysql/pdo_mysql.c:68 php 
startup prevents the seg-fault

configure line
--------------
./configure --enable-maintainer-zts --with-mysql --with-mysqli=mysqlnd --enable-
pdo --with-pdo-mysql 

gdb output
----------
gdb sapi/cli/php
GNU gdb Fedora (6.8-37.el5)
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) run
Starting program: /php-5.3.2/sapi/cli/php 
[Thread debugging using libthread_db enabled]
[New Thread 0xb7f776c0 (LWP 491)]
[New Thread 0xb7d0db90 (LWP 494)]
[Thread 0xb7d0db90 (LWP 494) exited]
Program received signal SIGSEGV, Segmentation fault.
0x08347ff5 in zend_startup_module_ex (module=0x98d2720, tsrm_ls=0x98b7050)
    at /opt/BoxUK/install/php-5.3.2/Zend/zend_API.c:1618
1618			EG(current_module) = NULL;


module->name at this point is "pdo_mysql"
 [2010-04-23 01:57 UTC] gnoodl at gmail dot com
In which stable version does this fix appear.

I've just upgraded to PHP 5.3.2 and whilst pdo_mysql.default_socket is returned 
correctly via ini_get(), attempting to make a connection results in the following 
exception

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 
'/tmp/mysql.sock'

FYI, my socket file resides at /var/lib/mysql/mysql.sock
 [2010-07-23 20:21 UTC] joelataylor at gmail dot com
I'm having this exact issue on 5.3.2 - installed via Zend Server. Having been 
hitting my head against a brick wall. I obviously can create a symbolic link, or 
use unix_socket - to point to the correct location - but would prefer localhost to 
work as expected.
 [2010-09-22 14:41 UTC] gnoodl+php at gmail dot com
So we're at v5.3.3 and this bug is still around :(

Status should be "Open"
 [2010-10-13 17:19 UTC] mbiechl at jahnsandfriends dot de
Confirming that bug still exists in PHP 5.3.3 cli
 [2011-01-07 12:03 UTC] hansfn at gmail dot com
I think this is actually fixed. The problem is subtle. Quote from http://www.php.net/manual/en/ref.pdo-mysql.connection.php:

--
When the host name is set to "localhost", then the connection to the server is made thru a domain socket. If PDO_MYSQL is compiled against libmysql then the location of the socket file is at libmysql's compiled in location. If PDO_MYSQL is compiled against mysqlnd a default socket can be set thru the pdo_mysql.default_socket setting. 
--

In other words, pdo_mysql.default_socket is ignored when PDO_MYSQL is compiled against libmysql.

I tested (on PHP 5.3.4, CentOS) with the code to reproduce the problem, and got the correct/expect result. But I still got the "Can't connect to local MySQL server through socket" error, because it turned out that PDO_MYSQL was compiled against libmysql - "php -i" tells me "--with-pdo-mysql=shared,/usr/lib/mysql/mysql_config". My problem was that /etc/my.cnf wasn't in sync with /usr/lib/mysql/mysql_config ...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC