Try this
$host="192.168.0.104";
exec("ping -c 4 " . $host, $output, $result);
print_r($output);
if ($result == 0)
echo "Ping successful!";
else
echo "Ping unsuccessful!";
Note: This is dependant on the OS you are running. Windows will default to only 4 pings while Linux will ping forever.
To ping twice in Windows, use "ping -n 2 host"
To ping twice in Linux, use "ping -c 2 host"