Does PHP block requests?

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

 



I have a tricky problem.

I'm trying to make a progress feedback mechanism to keep users informed about a
slowish process on the server end of a web app. The backend is generating a PDF
file from a bunch of data which extends to many pages. I can keep tabs on the
progress of this generation by working out how many lines of data is present,
and how much of it has been processed. I use that information to set a session
variable with a unique name - so for each step I set

$_SESSION['some-unique-name']=>Array('total'=>$totalLines,'count'=>$linesProcessedSoFar);

Now on the front end I'm doing an AJAX call to a script that just encodes this
session variable into a JSON string and sends it back.

The problem is that while the PDF is being generated, the AJAX calls to get the
progress data (on a 1-second interval) are being blocked and I don't get why.
The PDF generation is also triggered by an AJAX call to a script which generates
the PDF in a given file location, then returns a URL to retrieve it with.

So it appears that the problem is that I can't have two AJAX calls to different
PHP scripts at the same time? WTF?

Checking the requests with Wireshark confirms the the browser is certainly
sending the progress calls while the original PDF call is waiting, so it's not
the browser side that's the problem: and once the PDF call is finished the
outstanding progress calls are all serviced (returning 100% completion of course
- not much use!) Different browsers (Firefox, IE, Chrome at least) give the same
result.

For reference, the server is Apache 2.2.10 on a SuSE linux 11.1 box using
mod_php5 and mpm_prefork - is that part of the problem, and is there an alternative?
-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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