----- Original Message ----- From: "Robert Cummings" <rob...@interjinn.com>
To: "flint" <fmill...@gmail.com>
Cc: "PHP-General List" <php-general@lists.php.net>
Sent: Sunday, May 31, 2009 10:15 PM
Subject: Re: [PHP] spawning a process that uses pipes - doesn't terminatewhen webpage download is canceled

I'm already doing something like that... here's what I have basically

$o = popen($cmd);
while (!feof($o)) {
 $buffer = fread($o,4096);
 echo $p;

Ok so I can add in the statements to stop auto aborting, use connection aborted... but how do i kill the process chain itself? If I simply pclose the process it has the same effect - the other spawned processes keep running. I figured out what's happening is the lame process keeps going utnil it finishes, and apparently is sending its data to the proverbial bit bucket... and in a process tree it moves from being under the http process to being under init itself...


Use something else to pass the data back to the user... popen() comes to
mind or proc_open(). Then disable auto abort on user disconnect via
ignore_user_abort(). Then after sending periodic data chunks, check the
user connection status via connection_aborted(). If your script finds
that the user has aborted, then kill all the processes in the pipeline
from the PHP script before finally aborting the PHP script itself.

Application and Templating Framework for PHP

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to