Hi, I'm using PHP as a target language for web development. I want to use streams to output content, and am not sure how many bytes are to be output before I actually finish the streaming. The streams may be huge so it's no option to buffer them as it would take too much memory on my server. For this situation, the HTTP/1.1 protocol has introduced chunked transfer encoding.

In short, I want to use chunked transfer-encoding in PHP. So I want to set the transfer-encoding response header to 'chunked' and then output the content in chunks as specified in the HTTP protocol. My problem is that the transfer-encoding header is not sent in the response (seem to be blocked by php and/or apache) and that (because of that) the chunks are outputted as plain text.

How can I force PHP to not send a content-length header but a transfer-encoding: chunked header?