On Thu, 2010-01-21 at 08:22 +1100, Peter Rundle wrote: > 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. > > 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)". > > Thanks > > > Pete
You could try closing STDOUT which will tell apache that your script has stopped output. In perl I executed a background task with an system( "command &" ); to perform the background tasks. I then emailed a reponse to the client to tell them the job was done. Ta Ken -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html