Req #52071 [Opn->Wfx]: RFE: ping
| From: | rasmus@php.net | Date: | Sun, 13 Jun 2010 00:38:28 +0000 |
| Subject: | Req #52071 [Opn->Wfx]: RFE: ping | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151406@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52071&edit=1
ID: 52071
Updated by: rasmus@php.net
Reported by: php at richardneill dot org
Summary: RFE: ping
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Network related
Operating System: Linux
PHP Version: Irrelevant
New Comment:
This is not going to work in most PHP environments because doing
raw-socket ICMP
requests, like ping does requires root access. You will notice that
your ping
binary is setuid-root on your machine, so unless you are running PHP as
root,
doing it from within PHP simply won't work.
If you do have root access, it isn't that hard to do with a
socket_create(AF_INET, SOCK_RAW, getprotobyname('icmp')) call, but
since it
wouldn't work for most people, I don't see the point in adding it to
PHP.
Previous Comments:
------------------------------------------------------------------------
[2010-06-13 02:28:38] php at richardneill dot org
Description:
------------
Surprisingly, PHP is missing the ability to ping another host (and check
it's
alive). So I'd like to make a request to add it. I'd suggest using
something
like fping rather than standard ping, as this is more script-friendly -
for
example, fping can be made to return immediately as soon as it discovers
that
a given host is alive. For example:
fping -q -B1 www.php.net
I know that there is Net_Ping available via PEAR, but often PEAR
extensions
aren't available on many hosting environments; likewise it's awkward to
package a PHP web-application when the PEAR extension isn't already
packaged
for the distro. Is ping suficiently fundamental to be considered core?
Test script:
---------------
This command should either exist in 2 forms, or have several options.
Typical use cases are:
1. Is machine X alive (and responding to Pings)
2. Can I do a DNS lookup + route to that machine
3. What is the packet loss fraction.
This is easy enough to do by using exec(), but it would be nice to have
a native function. Thanks.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52071&edit=1