Re: How to disable PHP's POST caching?

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

 



Jochem Maas wrote:
Adam Zey wrote:

PHP seems to cache POST data, and waits for the entire POST to finish sending before it makes it available to php://input.

I'd like to be able to read the post data from php://input while the client is still uploading it. How can I cause PHP to make the POST data available right away instead of after the client finishes sending?

Regards, Adam Zey.

PS: As far as I can tell, PHP caches the entire POST in memory as it is being sent, but just doesn't make it available to php://input until after the client is done. Since PHP already has it in memory, why isn't it accessible?


are you sure it's php that is holding it in memory? $_POST is fully filled
on the first line of the script which gives me the impression that the webserver
is caching the response until it all been uploaded before even starting up
php.

or am I missing something here?

You're correct, of course. I was a bit confused, it seems.

PUT behaves as I described above. If you do a PUT request for the PHP script directly, the PHP script is called right away, and any attempt to fread from php://input blocks until either the client is done sending, or some sort of buffer is filled (the fread occasionally returns with lots of data if you keep sending).

So, might I amend my question to, is it possible to disable PHP buffering PUTs, or Apache buffering POST? (Or is it PHP that just buffers the POST before actually executing the script, but post Apache?)

Essentially what I want is a persistant HTTP connection over which I can stream data and have the server-side PHP script process the data as it arrives, rather than when all the data is sent.

The only other approach I can figure out is to send periodic POST requests with the latest data, the downside of which is a huge increase in latency between data production and consumption.

Regards, Adam Zey.

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