summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/pdo_mysql.c
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2011-11-02 15:45:53 +0000
committerJohannes Schlüter <johannes@php.net>2011-11-02 15:45:53 +0000
commit539a0f3bd340b6377ed3407d89665d2386fe0943 (patch)
treec07171a4ec10f2e2cd7d7057c941b9892dc6c5c8 /ext/pdo_mysql/pdo_mysql.c
parent2627fafcbdd81d9ec88e891cd6077ab42080352d (diff)
downloadphp-git-539a0f3bd340b6377ed3407d89665d2386fe0943.tar.gz
- Fix bug #60155 (pdo_mysql.default_socket ignored).
Diffstat (limited to 'ext/pdo_mysql/pdo_mysql.c')
-rwxr-xr-xext/pdo_mysql/pdo_mysql.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index b9fdc01f64..9545887fe8 100755
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -37,12 +37,22 @@ ZEND_GET_MODULE(pdo_mysql)
ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql);
-#ifndef PHP_WIN32
-# ifndef PDO_MYSQL_UNIX_ADDR
-# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
-# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
-# else
+/*
+ The default socket location is sometimes defined by configure.
+ With libmysql `mysql_config --socket` will fill PDO_MYSQL_UNIX_ADDR
+ and the user can use --with-mysql-sock=SOCKET which will fill
+ PDO_MYSQL_UNIX_ADDR. If both aren't set we're using mysqlnd and use
+ /tmp/mysql.sock as default on *nix and NULL for Windows (default
+ named pipe name is set in mysqlnd).
+*/
+#ifndef PDO_MYSQL_UNIX_ADDR
+# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
+# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
+# else
+# if !PHP_WIN32
# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
+# else
+# define PDO_MYSQL_UNIX_ADDR NULL
# endif
# endif
#endif
@@ -141,7 +151,7 @@ static PHP_MINFO_FUNCTION(pdo_mysql)
php_info_print_table_end();
-#ifdef PDO_USE_MYSQLND
+#ifndef PHP_WIN32
DISPLAY_INI_ENTRIES();
#endif
}