PHP 4.0 Bug #7607 Updated: system()ed commands do not exit if the user interrupts transfer
| From: | stas@php.net | Date: | Sun, 05 Nov 2000 12:53:12 +0000 |
| Subject: | PHP 4.0 Bug #7607 Updated: system()ed commands do not exit if the user interrupts transfer | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37178@lists.php.net to get a copy of this message | ||
ID: 7607
Updated by: stas
Reported By: doktor1@earthlink.net
Status: Closed
Bug Type: Program Execution
Assigned To:
Comments:
PHP cannot do this. Since PHP has no way to know which processes are launched with your system
command, and the Apache process does not stop - so system won't terminate executed process -
you should take care on this by yourself.
See for example proposal from Jean-Michel Dault <jmdault@mandrakesoft.com>:
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.
Previous Comments:
---------------------------------------------------------------------------
[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.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7607