Re: PHP 4.0 Bug #7607 Updated: system()ed commands do not exit if the user interrupts transfer
| From: | Jean-Michel Dault | Date: | Sun, 05 Nov 2000 12:27:39 +0000 |
| Subject: | Re: PHP 4.0 Bug #7607 Updated: system()ed commands do not exit if the user interrupts transfer | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-37175@lists.php.net to get a copy of this message | ||
On 5 Nov 2000 stas@php.net wrote:
> [2000-11-02 20:21:29] doktor1@earthlink.net
> 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.
This is an Apache issue. This bug is not present in the standalone
version. Even if you press stop, the apache process is trill running.
Solution:
system("/path/to/ping -w SECS somehost") to have it die after SECS seconds
But then, if you press stop, you'll still have zombie processes... So you
should try this:
echo "ping -w 30 \$1" > /tmp/ping;chmod 0755 /tmp/ping
... and have <?php system("/tmp/ping $host"); ?> instead
If fixes the problem.
------------------------------------------------------------
Jean-Michel Dault <jmdault@mandrakesoft.com>
MandrakeSoft inc, Montreal (Canada)
HTCPCP/1.0 Developper (http://www.ietf.org/rfc/rfc2324.txt)