Skip to content

Commit 3df26f1

Browse files
author
johannes
committed
- Fix bug #60155 (pdo_mysql.default_socket ignored).
git-svn-id: http://svn.php.net/repository/php/php-src/trunk@318696 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 102f406 commit 3df26f1

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

ext/pdo_mysql/mysql_driver.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,11 @@ static struct pdo_dbh_methods mysql_methods = {
525525
pdo_mysql_check_liveness
526526
};
527527
/* }}} */
528-
#ifdef PDO_USE_MYSQLND
529-
# ifdef PHP_WIN32
530-
# define MYSQL_UNIX_ADDR "MySQL"
531-
# else
532-
# define MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket)
533-
# endif
528+
529+
#ifdef PHP_WIN32
530+
# define MYSQL_UNIX_ADDR NULL
531+
#else
532+
# define MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket)
534533
#endif
535534

536535
/* {{{ pdo_mysql_handle_factory */

ext/pdo_mysql/pdo_mysql.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,22 @@ ZEND_GET_MODULE(pdo_mysql)
3737

3838
ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql);
3939

40-
#ifndef PHP_WIN32
41-
# ifndef PDO_MYSQL_UNIX_ADDR
42-
# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
43-
# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
44-
# else
40+
/*
41+
The default socket location is sometimes defined by configure.
42+
With libmysql `mysql_config --socket` will fill PDO_MYSQL_UNIX_ADDR
43+
and the user can use --with-mysql-sock=SOCKET which will fill
44+
PDO_MYSQL_UNIX_ADDR. If both aren't set we're using mysqlnd and use
45+
/tmp/mysql.sock as default on *nix and NULL for Windows (default
46+
named pipe name is set in mysqlnd).
47+
*/
48+
#ifndef PDO_MYSQL_UNIX_ADDR
49+
# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
50+
# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
51+
# else
52+
# if !PHP_WIN32
4553
# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
54+
# else
55+
# define PDO_MYSQL_UNIX_ADDR NULL
4656
# endif
4757
# endif
4858
#endif
@@ -141,7 +151,7 @@ static PHP_MINFO_FUNCTION(pdo_mysql)
141151

142152
php_info_print_table_end();
143153

144-
#ifdef PDO_USE_MYSQLND
154+
#ifndef PHP_WIN32
145155
DISPLAY_INI_ENTRIES();
146156
#endif
147157
}

0 commit comments

Comments
 (0)