diff options
author | Ulf Wendel <uw@php.net> | 2009-09-16 15:00:54 +0000 |
---|---|---|
committer | Ulf Wendel <uw@php.net> | 2009-09-16 15:00:54 +0000 |
commit | 20005db2a0469e5ca3ca0f8ed2277a9bea058529 (patch) | |
tree | 7e51d52454a32556c8e37dd6aa7ee19499608c4c /ext/mysqlnd/mysqlnd.h | |
parent | fb9c4bd70950b6daad08edd973273f069f23df4c (diff) | |
download | php-git-20005db2a0469e5ca3ca0f8ed2277a9bea058529.tar.gz |
Fix and tests for bug #49511 . mysqlnd and the MySQL Client Library (libmysql) use different networking APIs. mysqlnd does use PHP streams whereas libmysql uses its own wrapper of the operating level network calls. PHP sets by default a read timeout of 60s for streams - php.ini, default_socket_timeout. This default applies to all streams that set no other timeout value. mysqlnd has not set any other value and therefore it connections of long running queries can have been cut off after default_socket_timeout seconds resulting in a 2006 - MySQL Server has gone away error message. The MySQL Client Library sets a default timeout of 365 * 24 * 3600 seconds (1year) and waits for other timeouts to happen, e.g. TCP/IP timeouts. mysqlnd now uses the same very long timeout. The value is configurable through a new php.ini setting: mysqlnd.net_read_timeout. mysqlnd.net_read_timeout gets used by any extension (ext/mysql, ext/mysqli, PDO_MySQL) that uses mysqlnd. mysqlnd tells PHP Streams to use mysqlnd.net_read_timeout. Please note that there may be subtle differences between MYSQL_OPT_READ_TIMEOUT from the MySQL Client Library and PHP Streams. E.g. MYSQL_OPT_READ_TIMEOUT is documented to work only for TCP/IP connections and, prior to MySQL 5.1.2, only for Windows. PHP streams may not have this limitation. Please check the streams documentation, if in doubt.
Diffstat (limited to 'ext/mysqlnd/mysqlnd.h')
-rw-r--r-- | ext/mysqlnd/mysqlnd.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index 687b989303..79ce62f3ea 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -250,7 +250,7 @@ PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char * #define mysqlnd_select_db(conn, db, db_len) (conn)->m->select_db((conn), (db), (db_len) TSRMLS_CC) #define mysqlnd_ping(conn) (conn)->m->ping((conn) TSRMLS_CC) #define mysqlnd_kill(conn, pid) (conn)->m->kill_connection((conn), (pid) TSRMLS_CC) -#define mysqlnd_refresh(conn, options) (conn)->m->refresh_server((conn), (options) TSRMLS_CC) +#define mysqlnd_refresh(conn, options) (conn)->m->refresh_server((conn), (options) TSRMLS_CC) #define mysqlnd_shutdown(conn, level) (conn)->m->shutdown_server((conn), (level) TSRMLS_CC) #define mysqlnd_get_server_version(conn) (conn)->m->get_server_version((conn)) #define mysqlnd_set_character_set(conn, cs) (conn)->m->set_charset((conn), (cs) TSRMLS_CC) @@ -374,6 +374,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mysqlnd) #ifdef MYSQLND_THREADED THREAD_T thread_id; #endif + long net_read_timeout; ZEND_END_MODULE_GLOBALS(mysqlnd) ZEND_EXTERN_MODULE_GLOBALS(mysqlnd); |