hi,

2010/1/20 Peter Rundle <[email protected]>:
> Hi Sluggers,
>
> I hope this question is appropriate for this list. I have a PHP web-site
> running on Apache and Linux. A PHP routine produces a page that is sent back
> to the browser, but then it has some house-keeping to do which takes some
> time, perhaps many seconds but the housekeeping doesn't result in any more
> output to the browser (any output from that point on goes to a log).
>
> What I would like to do is end/close the http request so that the browser
> gets the HTTP equivelent of an "EOF" but allow the php script to keep
> running. Now flush() does send the output to date to the browser but the
> browsers "busy" icon keeps running because the http session isn't closed
> until the php ends.

woops, ignore my last post about flush(), should have read the whole
post. i blame the wine and being on holiday in europe...

> I thought of doing a "fork" but the PHP docs say that fork doesn't work when
> php is running under apache. I could write a shell script and invoke that
> with a system/exec call from php and have the shell run into the background
> and do the house-keeping thus allowing the php to finsih, but I'm wondering
> if sluggers know of "a better way (tm)".

how immediate does this need to be? unless this really needs to run
straight away, i'd put the "needs background work" request in a simple
queue and process it via a cron script. IMHO, putting a layer between
a web request and any serious out-of-band processing is the best way
to handle these cases.

cheers
justin
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to