php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7607 system()ed commands do not exit if the user interrupts transfer
Submitted: 2000-11-02 20:21 UTC Modified: 2000-11-05 07:53 UTC
From: doktor1 at earthlink dot net Assigned:
Status: Closed Package: Program Execution
PHP Version: 4.0.3 OS: SunOS 5.8 Generic sun4u sparc SU
Private report: No CVE-ID: None
 [2000-11-02 20:21 UTC] doktor1 at earthlink dot 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-05 07:53 UTC] stas@php.net
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.

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 06:01:26 2019 UTC