Yöntem 1 - ping programını kullanarak
?php
$output = shell_exec('ping -c1 google.com');
echo "<pre>$output</pre>";
?>
Yöntem 2 - Socket kullanarak
function ping($host, $port, $timeout) { 
  $tB = microtime(true); 
  $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); 
  if (!$fP) { return "down"; } 
  $tA = microtime(true); 
  return round((($tA - $tB) * 1000), 0)." ms"; 
}

//Echoing it will display the ping if the host is up, if not it'll say "down".
echo ping("www.google.com", 80, 10);
Yöntem 3 - ping class (yukarıdaki 2 yöntemi de bünyesinde barındırmakta)
https://github.com/geerlingguy/Ping