PHP :: Bug #50023 :: pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR
| Bug #50023 | pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR | ||||
|---|---|---|---|---|---|
| Submitted: | 2009-10-27 18:24 UTC | Modified: | 2009-10-29 13:34 UTC | ||
| From: | six at aegis-corp dot org | Assigned: | |||
| Status: | Closed | Package: | PDO related | ||
| PHP Version: | 5.3.1RC2 | OS: | linux 2.6 | ||
| Private report: | No | CVE-ID: | None | ||
[2009-10-27 18:24 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-10-29 13:34 UTC] iliaa@php.net