RE: [PHP-DEV] PHP 4.0 Bug #7607: system()ed commands do not exit ifthe user interrupts transfer
| From: | Stu | Date: | Fri, 03 Nov 2000 19:50:20 +0000 |
| Subject: | RE: [PHP-DEV] PHP 4.0 Bug #7607: system()ed commands do not exit ifthe user interrupts transfer | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-37017@lists.php.net to get a copy of this message | ||
> > On 3 Nov 2000 doktor1@earthlink.net wrote:
> >
> > > From: doktor1@earthlink.net
> > > Operating system: SunOS 5.8 Generic sun4u sparc SUNW,Ultra-2
> > > PHP version: 4.0.3
> > > PHP Bug Type: POSIX related
> > > Bug description: system()ed commands do not exit if the user
> interrupts transfer
> > >
> > > If I system("/path/to/ping somehost") and then hit Stop or
> close the browser or go to a different page, the ping process
> will still be in the process table, and show as being owned
> (PPID) by httpd. I don't know whether this is an issue with php
> or with Apache.
> > >
> >
> > system() uses popen() in its underlying implementation. Apparently PHP
> > doesn't keep track of what it keeps open and kill them afterward. Try
> > using ping -c to limit the number of ping tests or use sockets to do it
> > low level within PHP itself.
I am using -c. If I let ping finish, it exits properly and is removed from
the process table. The trouble happens when I close the connection to the
web server while ping is still trying to write output.
> Unfortunately, the latter can't be done from within PHP, unless PHP is
> running with root priveliges. In order to send ICMP packets, one must open
> a raw socket, which is usually a priveliged operation..
>
> Chris
The web server does not run as root, and it does have the ability to run
ping, just like any user with access to that machine can run ping without
being root.