Situation: a user clicks on a link, the server gets the request and starts processing it. In the meanwhile, the user clicks on another link, the server gets the new request while processing the 1st one. What happens? On the client side we only see the webpage from the 2nd request, but is the process from the 1st request killed on the server when receiving the 2nd one? And is it managed by the server or the language (Apache or PHP)?
3 Answers
Depends. If the browser does not drop the connection to server, it'll have absolutely no idea that the client has navigated elsewhere. If it does drop the connection, it's up to the Web server to choose to detect it and abort the processing thread or not.
Either case, this is the nature of statelessness of HTTP. You shouldn't rely on anything in this regard.
Comments
You can use ignore_user_abort() to tell a script to continue (or not) after the connection has been terminated.