From: xiaojb at gmail dot com Operating system: RedHat PHP version: 5.2.1 PHP Bug Type: MySQL related Bug description: mysql_ping cann't work
Description: ------------ if mysql server is 5.0.13 and later, mysql client MUST set option "MYSQL_OPT_RECONNECT" to TRUE, then mysql_ping will work. http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html [EMAIL PROTECTED] /usr/local/src/php-5.2.1$ diff ext/mysql/php_mysql.c /tmp/php_mysql.c 674a675,677 > #if MYSQL_VERSION_ID > 50012 > mysql_options(&mysql->conn, MYSQL_OPT_RECONNECT, "1"); > #endif 779a783,785 > #if MYSQL_VERSION_ID > 50012 > mysql_options(&mysql->conn, MYSQL_OPT_RECONNECT, "1"); > #endif [EMAIL PROTECTED] /usr/local/src/php-5.2.1$ diff -u ext/mysql/php_mysql.c /tmp/php_mysql.c --- ext/mysql/php_mysql.c 2007-01-01 17:36:03.000000000 +0800 +++ /tmp/php_mysql.c 2007-04-14 08:39:30.000000000 +0800 @@ -672,6 +672,9 @@ mysql->active_result_id = 0; #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */ mysql_init(&mysql->conn); +#if MYSQL_VERSION_ID > 50012 + mysql_options(&mysql->conn, MYSQL_OPT_RECONNECT, "1"); +#endif if (connect_timeout != -1) mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); @@ -777,6 +780,9 @@ mysql->active_result_id = 0; #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */ mysql_init(&mysql->conn); +#if MYSQL_VERSION_ID > 50012 + mysql_options(&mysql->conn, MYSQL_OPT_RECONNECT, "1"); +#endif if (connect_timeout != -1) mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); -- Edit bug report at http://bugs.php.net/?id=41083&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41083&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41083&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41083&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41083&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41083&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41083&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41083&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41083&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41083&r=support Expected behavior: http://bugs.php.net/fix.php?id=41083&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41083&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41083&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41083&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41083&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41083&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41083&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41083&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41083&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41083&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41083&r=mysqlcfg
