php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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:
 [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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-29 13:33 UTC] 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-29 13:34 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.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 09:02:28 2014 UTC