I am trying to figure out how the \"talking\" between the server and the client is done.
So, when the server is generating an infinite loop, echoing
Even if your php script has an infinite loop, php.ini has a max_execution_time which will kill the process if the time exceeds.
I am not sure how it will work when the client closes a connection. Apache might kill the process but I don't think PHP will be notified of the client's connection closing.