<?php
include "connect.inc";
+ if ($socket)
+ $host = sprintf("%s:%s", $host, $socket);
+ else if ($port)
+ $host = sprintf("%s:%s", $host, $port);
+
$tmp = NULL;
$link = NULL;
Warning: mysql_ping(): MySQL server has gone away in %s on line %d
reconnect
OK
-done!
\ No newline at end of file
+done!
mysql_close($plink);
- if (!($plink = mysql_pconnect($myhost, $user, $passwd)))
+ /* mysql_pconnect cound generate a warning when linked against mysqlnd
+ PHP Warning: mysql_pconnect(): MySQL server has gone away */
+ if (!($plink = @mysql_pconnect($myhost, $user, $passwd)))
printf("[009] Cannot create new persistent connection, [%d] %s\n", mysql_errno(), mysql_error());
mysql_select_db($db, $plink);
net->packet_no = net->compressed_envelope_packet_no = 0;
+ if (net->stream) {
+ /* close before opening a new one */
+ DBG_INF_FMT("Freeing stream. abstract=%p", net->stream->abstract);
+ if (net->persistent) {
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
+ } else {
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE);
+ }
+ net->stream = NULL;
+ }
+
if (net->options.timeout_connect) {
tv.tv_sec = net->options.timeout_connect;
tv.tv_usec = 0;