|
|
|
สอบถามการเช็ค Connect Uptime กับ Database server และ Dns Server ครับ |
|
|
|
|
|
|
|
ผมลองใช้แบบนี้ไม่รู้ว่ามันจะถูกหรือเปล่าครับ???
$fp1 = fsockopen("localhost", 8889, $errno, $errstr, 30);
if (!$fp1) {
echo "$errstr ($errno)<br />\n";
} else {
$objConnect = mysql_connect("localhost","root","root");
if($objConnect) {
echo "Database Connected.<br />";
}
else {
echo "Database Connect Failed.<br />";
}
mysql_close($objConnect);
fclose($fp1);
} //Core code check Database Server
$fp2 = fsockopen("8.8.8.8", 53, $errno, $errstr, 30);
if (!$fp2) {
echo "$errstr ($errno)<br />\n";
} else {
$ip = gethostbyname('www.facebook.com');
echo $ip;
}
fclose($fp2);
//Core code check DNS Server
|
|
|
|
|
Date :
2011-12-30 00:30:48 |
By :
sincerely |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|