Re: Stop PHP execution on client connection closed

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

 



On 13/09/2011 09:01, Marco Lanzotti wrote:
> Il 13/09/2011 09:39, vikash.iitb@xxxxxxxxx ha scritto:
>>
>> You can use ob_start() to start output buffering and ob_end_flush() to send
>> some data in the middle of script  - that way  your php script will send
>> some data to the client earlier than finishing execution and hence detect
>> the aborted connection.
> 
> The question is: how can I send data to client until I'm waiting for
> query execution? PHP thread support is not available in Apache enviroment.
> 
> Bye,
> Marco
> 

Hi Marco,

You may have to think of this problem a different way.


How about about creating a job queuing system to handle the long running
database queries.  You will have to break it down into steps:



User initiatives Query via AJAX call.

System receives query and adds it to queue, return status of 'Added to
queue'

System daemon monitors job queue and runs / records status / stores
results of jobs.

Background process on web page monitors job status via AJAX calls and
alerts user when complete.



On linux systems, The pear module 'System Daemon' is very good for job
queues and easy to install:

[http://pear.php.net/package/System_Daemon]



Hope this helps.

Ian
-- 




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