Fix for bug#45179 --with-mysql-sock fails to compile & work
Now --with-mysql-sock controls all mysql extensions. If provided it will be
the default value as it was set in php.ini . php.ini will override it for
ext/mysql and ext/mysqli but not for pdo_mysql
This commit is contained in:
Andrey Hristov 2008-07-21 13:01:41 +00:00
parent 78bab4d9b3
commit 0df974b7a5
9 changed files with 41 additions and 12 deletions

View File

@ -31,7 +31,7 @@ AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [
done
if test -n "$MYSQL_SOCK"; then
AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ])
AC_MSG_RESULT([$MYSQL_SOCK])
else
AC_MSG_RESULT([no])
@ -45,7 +45,7 @@ PHP_ARG_WITH(mysql, for MySQL support,
the MySQL native driver will be used [/usr/local]])
PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
[ --with-mysql-sock[=DIR] MySQL: Location of the MySQL unix socket pointer.
[ --with-mysql-sock[=DIR] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
If unspecified, the default locations are searched], no, no)
if test -z "$PHP_ZLIB_DIR"; then
@ -62,7 +62,7 @@ elif test "$PHP_MYSQL" != "no"; then
AC_MSG_CHECKING([for MySQL UNIX socket location])
if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
MYSQL_SOCK=$PHP_MYSQL_SOCK
AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ])
AC_MSG_RESULT([$MYSQL_SOCK])
elif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL_SOCK" = "yes"; then
PHP_MYSQL_SOCKET_SEARCH

View File

@ -394,7 +394,11 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("mysql.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysql_globals, mysql_globals)
STD_PHP_INI_ENTRY("mysql.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_mysql_globals, mysql_globals)
PHP_INI_ENTRY("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort)
#ifdef MYSQL_UNIX_ADDR
STD_PHP_INI_ENTRY("mysql.default_socket", MYSQL_UNIX_ADDR,PHP_INI_ALL,OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals)
#else
STD_PHP_INI_ENTRY("mysql.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals)
#endif
STD_PHP_INI_ENTRY("mysql.connect_timeout", "60", PHP_INI_ALL, OnUpdateLong, connect_timeout, zend_mysql_globals, mysql_globals)
STD_PHP_INI_BOOLEAN("mysql.trace_mode", "0", PHP_INI_ALL, OnUpdateLong, trace_mode, zend_mysql_globals, mysql_globals)
STD_PHP_INI_BOOLEAN("mysql.allow_local_infile", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_local_infile, zend_mysql_globals, mysql_globals)

View File

@ -43,6 +43,13 @@
#include <mysql.h>
#endif
#ifdef PHP_MYSQL_UNIX_SOCK_ADDR
#ifdef MYSQL_UNIX_ADDR
#undef MYSQL_UNIX_ADDR
#endif
#define MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
#endif
#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007 || MYSQL_USE_MYSQLND
#define MYSQL_HAS_SET_CHARSET
#endif

View File

@ -644,7 +644,11 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("mysqli.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysqli_globals, mysqli_globals)
STD_PHP_INI_ENTRY("mysqli.default_pw", NULL, PHP_INI_ALL, OnUpdateString, default_pw, zend_mysqli_globals, mysqli_globals)
STD_PHP_INI_ENTRY("mysqli.default_port", "3306", PHP_INI_ALL, OnUpdateLong, default_port, zend_mysqli_globals, mysqli_globals)
#ifdef PHP_MYSQL_UNIX_SOCK_ADDR
STD_PHP_INI_ENTRY("mysqli.default_socket", MYSQL_UNIX_ADDR,PHP_INI_ALL,OnUpdateStringUnempty, default_socket, zend_mysqli_globals, mysqli_globals)
#else
STD_PHP_INI_ENTRY("mysqli.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysqli_globals, mysqli_globals)
#endif
STD_PHP_INI_BOOLEAN("mysqli.reconnect", "0", PHP_INI_SYSTEM, OnUpdateLong, reconnect, zend_mysqli_globals, mysqli_globals)
STD_PHP_INI_BOOLEAN("mysqli.allow_local_infile", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_local_infile, zend_mysqli_globals, mysqli_globals)
#ifdef MYSQLI_USE_MYSQLND

View File

@ -45,6 +45,13 @@
#include "mysqli_libmysql.h"
#endif
#ifdef PHP_MYSQL_UNIX_SOCK_ADDR
#ifdef MYSQL_UNIX_ADDR
#undef MYSQL_UNIX_ADDR
#endif
#define MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
#endif
#include "php_mysqli.h"
/* character set support */

View File

@ -47,7 +47,11 @@ Note that the MySQL client library is not bundled anymore!])
PDO_MYSQL_SOCKET=`$PDO_MYSQL_CONFIG --socket`
fi
AC_DEFINE_UNQUOTED(PDO_MYSQL_UNIX_ADDR, "$PDO_MYSQL_SOCKET", [ ])
if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
AC_DEFINE_UNQUOTED(PDO_MYSQL_UNIX_ADDR, "$PHP_MYSQL_SOCK", [ ])
else
AC_DEFINE_UNQUOTED(PDO_MYSQL_UNIX_ADDR, "$PDO_MYSQL_SOCKET", [ ])
fi
PHP_ADD_LIBRARY_WITH_PATH(mysqlclient, $PDO_MYSQL_LIB_DIR, PDO_MYSQL_SHARED_LIBADD)
PHP_ADD_INCLUDE($PDO_MYSQL_INC_DIR)

View File

@ -417,13 +417,6 @@ static struct pdo_dbh_methods mysql_methods = {
pdo_mysql_check_liveness
};
#ifndef PDO_MYSQL_UNIX_ADDR
# ifdef PHP_WIN32
# define PDO_MYSQL_UNIX_ADDR "MySQL"
# else
# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
# endif
#endif
static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */
{

View File

@ -101,7 +101,8 @@ PHP_MSHUTDOWN_FUNCTION(pdo_mysql)
PHP_MINFO_FUNCTION(pdo_mysql)
{
php_info_print_table_start();
php_info_print_table_header(2, "PDO Driver for MySQL 3.x Client Libraries", "enabled");
php_info_print_table_header(2, "PDO Driver for MySQL, client library version", mysql_get_client_info());
php_info_print_table_row(2, "MYSQL_SOCKET", PDO_MYSQL_UNIX_ADDR);
php_info_print_table_end();
}
/* }}} */

View File

@ -87,4 +87,13 @@ enum {
PDO_MYSQL_ATTR_MAX_BUFFER_SIZE,
PDO_MYSQL_ATTR_DIRECT_QUERY,
};
#ifndef PDO_MYSQL_UNIX_ADDR
# ifdef PHP_WIN32
# define PDO_MYSQL_UNIX_ADDR "MySQL"
# else
# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
# endif
#endif
#endif