Today, my co-worker (MediaStar), told me about this thread and now i'm interested.

why didn't you just ask us directly in the first place?

So, since knowledge is for sharing, first, we don't use PHP but we use NodeJS.

Second, we uses NodeJS's fs.pipe to pipe the server request response directly to the client.

As the documentation inside NodeJS said, pipe was done by pausing and resuming the response (ex: filehosting) whenever necessarily while writing to the client at the same time. Just imagine, whenever our server writes data to the client, our server will pause the download for a moment, then when finished writing, our download will resume. The process will repeat until the download finished.

So, I think in PHP, you can do the same by following the same algorithm but just requires some extra works.

Hope this helps, next time, ask directly.

Sincerely, PyroStrex.

and yes, I did sign up just to reply this message. But since I'm now a member, I think I will contribute something.