Hi Mark,

At 02:04 3-6-2002, Mark shared with all of us:

> > Yes and no. I do want that, but afterwards I want to connect.
>
>
>It still does not look to me like you really want to ping the server. What
>you seem to want is to check whether the server is alive; and if not,
>reconnect; right?

Connect - I want to switch servers then. If a server dies during page 
execution,
that's just tough luck or I have hit a bug in mysqld.

>sub connect_mysql {
>     $dbh = DBI -> connect ( ... );
>}

Yes - problem there is:
when the machine mysqld is running on, is disconnected from the network - like
when it's died or somebody messed with a cable, that will timeout - with
max_execution_time set to 900secs, you don't want that.

The same applies to the `mysqladmin ping' utility by the way - it runs forever,
so that's why I can't modify the mysql-php extension to make use of this 
timeout
feature in the mysql C API.

So - I use a low-level socket function, which has a hard timeout and set 
that to
10 secs.

The drawback is that I have to set max_connect_errors to a very high value 
and pray
we never get there or run a flush hosts via a crontab every now and then.

So - indeed - I'm probably barking up the wrong tree, by looking at 
mysql_ping(),
but I basically want to mimmick the behavior, so the there's no connection 
error
for the webserver involved.

See it as Net::SMTP, using a simple HELO - RSET - QUIT.



Best regards,

Melvyn Sopacua
WebMaster IDG.nl
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
If it applies, where it applies - this email is a personal
contribution and does not reflect the views of my employer
IDG.nl.
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to