Re: Run a script apart from request

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

 



On 4/30/07, Brad Fuller <bfuller@xxxxxxxxxxxxxxxx> wrote:
Hi all,

I am developing a program that does some intensive data processing, and is
triggered from a page hit and/or a SOAP request.

The processing takes on average 30 seconds to 1 minute, which is OK for a
web page (I can use set_time_limit(0) and just display a pseudo-progress bar
animated gif and a "Please wait..." message) but I can't leave the SOAP
request hanging for that long.  I need to send a response immediately.

What I really need to do is acknowledge the client that their request has
been received and will be processed, and terminate that request... and THEN
begin the processing.

One way I thought of doing it would be to put the requests into the database
and run a cron job every X minutes, but I would like to avoid this if at all
possible.

Someone had suggested pcntl_fork() but I'm not sure if that will accomplish
what I need it to... if I fork(), then send a response, kill the parent and
let the child run the process, will the HTTP request wait for the child or
will it die with the parent (like I want it to) ?

Any advice is much appreciated.

Thx,

Brad

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


This topic comes up every now and again.  You can search the mailing
list archives for all sorts of answers.  You can also handle this by
using fsockopen and hitting your execute script with a low timeout.
That way it will execute and you don't have to wait for it.

--
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