tags:

views:

49

answers:

1

I'm running PHP under Apache and I'd like to send a slow trickle of POST data to the page that will write messages into a database as the POST data arrives. I'm sending the data from a .NET app using WebRequest and I've set SendChunked to true.

Unfortunately, it looks like the PHP script doesn't start executing until all the POST data has arrived. I looked in the apache log, and I see that the request starts right away, but echo strftime(...) statements in the PHP script show that it isn't running until after all the POST data was received.

Is there any way to tell PHP to start right away? I tried setting always_populate_raw_post_data = Off in the PHP.ini file, but that didn't make any difference. My request has a content type of application/octet-stream, and $HTTP_RAW_POST_DATA is still filled with all the POST data.

+5  A: 

You can do this using the HTTP PUT method, but not with POST.

When the client uses the PUT verb the data is streamed in to PHP. It can be accessed through the php:://input stream byte by byte as it is sent from the client.

Byron Whitlock
At last I find out what PUT is good for.
Don Kirkby