1

How to kill shell_exec process by PHP termination

view story
linux-howto

http://serverfault.com – I run a shell command within PHP as shell_exec("find / test.txt"); PHP initiates this process but does not kill it. If interrupting the PHP (e.g. by closing the browser), PHP processes will be terminated but not the shell process. The problem arises when the process is too long (like the above example), it will continue to consume lots of resources for a process which is no longer needed. How to kill the shell process upon terminating the PHP process, even if the shell process is still running. (HowTos)