I want to check if another machine is generally responding with PHP.
Most approaches are to ping some service running on the target machine, but I want to check if the machine is online generally.
I've found http://birk-jensen.dk/2010/09/php-ping/ which supposedly sends an ICMP Ping package. The problem is, somehow one is required to be root
to perform a socket_create(AF_INET, SOCK_RAW, 1)
. The workaround via posix_seteuid(0)
doesn't work either, since elevated permissions are required for that too.
Any functions that would let me run the ping
program are not available in my scenario either.
So how do I check if a server is online using php?
You can always use Net_Ping to ping from php http://pear.php.net/package/Net_Ping/redirected
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With