make ping with PHP

guif's Avatar
Go4Expert Member
I would like to make a simple monitoring. I make this:

Code:
<?php
$ip = $_SERVER['127.0.0.1'];
exec("ping -n 4 $ip 2>&1", $output, $retval);
if ($retval != 0) { 
echo "no!"; 
} 
else 
{ 
echo "yes!"; }
?>
I use my internal IP: 127.0.0.1.
The result is: NO!

why???
0
asha's Avatar, Join Date: Nov 2006
Go4Expert Member
What platform are you running the script on?