Your code works for me in a basic tinker session
>>> $ping = exec("ping -c 1 -s 64 -t 64 127.0.0.1", $output);
>>> $output
=> [
"PING 127.0.0.1 (127.0.0.1) 64(92) bytes of data.",
"72 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.016 ms",
"",
"--- 127.0.0.1 ping statistics ---",
"1 packets transmitted, 1 received, 0% packet loss, time 0ms",
"rtt min/avg/max/mdev = 0.016/0.016/0.016/0.000 ms",
]
Some server firewalls block icmp requests. Are you sure you can actually ping it?
You might have better luck just issuing a GET request to the homepage and checking the response status and time.