Can a PHP script start before all POST data is received?
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.
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.
精彩评论