Re: spawning a process that uses pipes -doesn'tterminatewhen webpage download is canceled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've pasted a section of PHP script to pastebin that uses proc_open() to
control mplayer. Glean from it what you will :)

    http://pastebin.com/m4dfd2012

Cheers,
Rob.


On Mon, 2009-06-01 at 11:14 -0500, Flint Million wrote:
> Rob: Perfect explanation of my problem. do you have any sample code I could 
> look at for proc_open? It looks like it might do what I need but it's a lot 
> more complex than popen.
> 
> fm
> 
> --------------------------------------------------
> From: "Robert Cummings" <robert@xxxxxxxxxxxxx>
> Sent: Monday, June 01, 2009 10:01 AM
> To: "bruce" <bedouglas@xxxxxxxxxxxxx>
> Cc: "'PHP-General List'" <php-general@xxxxxxxxxxxxx>
> Subject: RE:  spawning a process that uses pipes -doesn'tterminatewhen 
> webpage download is canceled
> 
> > On Mon, 2009-06-01 at 07:52 -0700, bruce wrote:
> >> hi robert...
> >>
> >> i got the popen/php process but i don't see how one can stop a
> >> browser/apache process, and somehow reattach to the browser process.. 
> >> unless
> >> he's talking about stopping a process within the app's context.. and then
> >> contniuing..
> >
> > Hi Bruce,
> >
> > He's spawning child processes to handle the audio changes. These
> > processes are separate processes from the PHP script being run by the
> > webserver. However, they are children of the PHP script process since
> > they have been started by the PHP script via popen() or proc_open(). His
> > problem is that when the user changes page mid load, or shuts down the
> > browser, the PHP script (the parent) is killed off by the webserver, but
> > the child processes, sox and lame, continue to run. This ends up
> > polluting CPU/memory with useless processes. What he wants is to have
> > these processes also die. So by using proc_open() he can retrieve the
> > output from the processes he has started and send that to the connected
> > browser in chunks, but also detect if the browser has dropped its
> > connection in which case he can manually kill of the child processes
> > that aren't being killed automatically. HTH.
> >
> > Cheers,
> > Rob.
> > -- 
> > http://www.interjinn.com
> > Application and Templating Framework for PHP
> >
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > 
> 
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux