php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50231 Socket path passed using --with-mysql-sock is ignored when mysqlnd is enabled
Submitted: 2009-11-19 14:55 UTC Modified: 2009-11-30 15:13 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: foutrelis at gmail dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 5.3.1 OS: Arch Linux
Private report: No CVE-ID:
 [2009-11-19 14:55 UTC] foutrelis at gmail dot com
Description:
------------
Looking at ext/mysql/config.m4, it seems to me that the path specified during the ./configure step using the --with-mysql-sock option gets ignored and PHP_MYSQL_UNIX_SOCK_ADDR isn't defined accordingly. This causes mysqlnd to always use its default socket path (/tmp/mysql.sock).

I wrote a patch [1] to move the related code in its own if clause so that it gets executed regardless of whether mysqlnd or libmysqlclient is used. However, I was unable to test it because I'm not sure how to regenerate the configure script (I tried with autoreconf but the produced configure script freaked out; something about confdefs.h missing).

Let me know if you need any more information from me.

----
[1] http://bugs.archlinux.org/task/17179?getfile=4423


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-19 15:45 UTC] foutrelis at gmail dot com
Tried with the snapshot; same problem.

 [foutrelis@foutboxd php]$ php -r 'mysql_connect();'
 PHP Warning:  mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in Command line code on line 1
 PHP Warning:  mysql_connect(): No such file or directory in Command line code on line 1


`php -i' output: http://omploader.org/vMnQxNQ/phpinfo.txt
 [2009-11-19 22:15 UTC] foutrelis at gmail dot com
The pdo_mysql extension is affected as well. When mysqlnd is enabled, PDO_MYSQL_UNIX_ADDR doesn't get defined and it uses /tmp/mysql.sock instead of the path retrieved using `mysql_config --socket'.

In this case, the code in ext/pdo_mysql/config.m4 is a bit more involved, so I won't attempt to come up with a patch. :>
 [2009-11-30 15:11 UTC] svn@php.net
Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=291501
Log: - Fixed bug #50231 (Socket path passed using --with-mysql-sock is ignored when mysqlnd is enabled)
 [2009-11-30 15:13 UTC] jani@php.net
Fixed both ext/pdo_mysql and ext/mysql, hopefully it works now. :)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 02:02:11 2014 UTC