Bug #50829 [Com]: php.ini directive pdo_mysql.default_socket is ignored

From: Date: Fri, 07 Jan 2011 11:03:35 +0000
Subject: Bug #50829 [Com]: php.ini directive pdo_mysql.default_socket is ignored
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157731@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=50829&edit=1

 ID:                 50829
 Comment by:         hansfn at gmail dot com
 Reported by:        giovanni at giacobbi dot net
 Summary:            php.ini directive pdo_mysql.default_socket is
                     ignored
 Status:             Closed
 Type:               Bug
 Package:            PDO related
 Operating System:   Linux
 PHP Version:        5.3.2RC1
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2010-10-13 17:19:56] mbiechl at jahnsandfriends dot de

Confirming that bug still exists in PHP 5.3.3 cli

------------------------------------------------------------------------
[2010-09-22 14:41:36] gnoodl+php at gmail dot com

So we're at v5.3.3 and this bug is still around :(

Status should be "Open"

------------------------------------------------------------------------
[2010-07-23 20:21:24] 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-04-23 01:57:46] 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-03-24 17:49:55] 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"

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=50829


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50829&edit=1


Thread (8 messages)

« previous php.bugs (#157731) next »