What happens when the server is in an infinite loop and the client stops?
The client (browser) has a TCP/IP session established with your server, waiting for the HTTP response of your website. When the user hits back/cancel/close, this TCP connection is closed immediately by the client.
The webserver (i.e. apache) will inform the PHP interpreter of the TCP connection close.
Unless the php.ini
directive ignore_user_abort
is set to 1
(on server side, 0
is PHP default), the PHP interpreter will then abort script execution when the current atomic operation finishes (in your example: echo()
)
However, even when you set ignore_user_abort
explicitly to 1
you will hit PHPs max_execution_time
or the apache TimeOut
(both are configurable on server side, too)
also see ignore_user_abort()
and set_time_limit()