Edit report at http://bugs.php.net/bug.php?id=52561&edit=1

 ID:                 52561
 Updated by:         and...@php.net
 Reported by:        paulgao at yeah dot net
 Summary:            function mysqli_ping no attempted reconnection!
-Status:             Assigned
+Status:             Wont fix
 Type:               Bug
 Package:            MySQL related
 Operating System:   irrelevant
 PHP Version:        5.3.3
 Assigned To:        mysql
 Block user comment: N

 New Comment:

You are using mysqlnd and it doesn't reconnect. It has no such
capability by design. reconnect is off by default since ages and is
considered dangerous. Thus, reconnect wasn't implemented in mysqlnd.
Ergo, mysqli.reconnect has no meaning.

You can either stay with libmysql, which however is not recommended in
the long run. Or change your code so you reconnect explicitly.


Previous Comments:
------------------------------------------------------------------------
[2010-08-14 19:28:48] paulgao at yeah dot net

when i use libmysql, sleep 31s+, mysqli_ping() is work, it can
reconnection.

------------------------------------------------------------------------
[2010-08-14 18:41:12] ka...@php.net

Does this happen with libmysql aswell?

------------------------------------------------------------------------
[2010-08-07 13:41:12] paulgao at yeah dot net

and mysql server version 5.1.49.

------------------------------------------------------------------------
[2010-08-07 13:32:26] paulgao at yeah dot net

Description:
------------
I use mysqli_ping reconnection database when php script long time run.

when my use mysqlnd module, mysqli_ping() is run fail, errormsg is
"MySQL server has gone away".



mysqli.reconnect setting is ON. 

mysql server timeout is 30s.

Test script:
---------------
<?php

mysqli = new mysqli("localhost", "xxx", "xxx");



/* check connection */

if (mysqli_connect_errno()) {

    printf("Connect failed: %s\n", mysqli_connect_error());

    exit();

}

sleep(31);

/* check if server is alive */

if ($mysqli->ping()) {

    printf ("Our connection is ok!\n");

} else {

    printf ("Error: %s\n", $mysqli->error);

}



/* close connection */

$mysqli->close();

?>

Expected result:
----------------
Our connection is ok!

Actual result:
--------------
Error: MySQL server has gone away


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52561&edit=1

Reply via email to