PHP will send a default response if the headers are sent and the header is Content-Lengthnot specified. If you are familiar with the HTTP specification, this is the only logical thing to do, as the client on the other end needs to know when the HTTP message you send ends so that it can stop reading.
, ...
, - . , . , Content-Length, PHP .
header("Transfer-encoding: chunked");
header("Trailer: X-My-Trailer-Header");
flush();
echo dechex(strlen($myChunk)) . "\r\n";
echo $myChunk;
echo "\r\n";
flush();
echo "0\r\n";
flush();
echo "X-My-Trailer-Header: some-value\r\n";
flush();