#50023 [Opn->Csd]: pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR
| From: | iliaa@php.net | Date: | Thu, 29 Oct 2009 13:34:29 +0000 |
| Subject: | #50023 [Opn->Csd]: pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-144073@lists.php.net to get a copy of this message | ||
ID: 50023
Updated by: iliaa@php.net
Reported By: six at aegis-corp dot org
-Status: Open
+Status: Closed
Bug Type: PDO related
Operating System: linux 2.6
PHP Version: 5.3.1RC2
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2009-10-29 13:33:52] svn@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=290053
Log: Fixed bug #50023 (pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR)
# Original patch by six at aegis-corp dot org
------------------------------------------------------------------------
[2009-10-27 18:24:27] six at aegis-corp dot org
Description:
------------
since 5.3.0, the PDO Mysql driver doesn't use the --with-mysql-sock
configure option (help says : --with-mysql-sock[=DIR]
MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.) and
always uses /tmp/mysql.sock.
Patch below:
--- pdo_mysql.c.orig 2009-10-27 18:02:56.000000000 +0100
+++ pdo_mysql.c 2009-10-27 19:15:38.000000000 +0100
@@ -40,7 +40,11 @@
#ifndef PHP_WIN32
# ifndef PDO_MYSQL_UNIX_ADDR
-# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
+# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
+# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
+# else
+# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
+# endif
# endif
#endif
Reproduce code:
---------------
./configure --with-mysql-sock=/var/run/mysqld/mysqld.sock [...] && make
&& make install
and then:
php -r 'new PDO("mysql:host=localhost");'
Expected result:
----------------
nothing
Actual result:
--------------
Warning: PDO::__construct(): [2002] No such file or directory (trying
to connect via unix:///tmp/mysql.sock) in Command line code on line 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50023&edit=1