"Markus H. Maussner" wrote:
> 
> hi..
> 
> i have the problem that i need to connect to a database on a server wich
> is quiet often offline.
> 
> how can i connect to this database (mysql) and can check if the server is
> online.
> like.. if server is online -> fine we work as normaly
> if server is NOT online -> print out message and say "server offline try
> later"....
> 
> i tried something like mysql_connect and then die ...
> but it takes approx 5 mins.. till i get the message..
> do i have to set the timeout lower? and if yes.. how do i do that ?

You could use ping command like this:

exec("ping -c 4 TheServer",$out_arr);

...and evaluate the $out_arr to see if the ping command was successful.


Robert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to