I try to execute the script, i just have command not found, what happens ?
PHP CLI is not installed or not in the PATH. Try to check if PHP CLI is installed on your system.
In my case, the latency is always equal to the timout value, why ?
It is probably because the IP doesn't respond on the requested port (for fsock method), or doesn't answer to ping requests, for example if a firewall is blocking ICMP protocole.
In such a case, it is worthy to change method and/or port.
When choosing icmp method, why the script need to be executed as root user ?
Only root user can open a raw socket, raw socket is needed to do icmp, and the script doesn't have the sticky bit, so the script needs to have root rights.