Kill PHP process when connection is closed

Posted by user838437 on Server Fault See other posts from Server Fault or by user838437
Published on 2012-01-29T15:41:59Z Indexed on 2014/06/11 9:28 UTC
Read the original article Hit count: 147

Filed under:
|
|
|

I've posted the following question to SO, but thought there might be a server based solution.

http://stackoverflow.com/questions/9053964/php-script-with-sleep-does-not-exit-on-connection-close

I'm running an Ubuntu VPS to run this script, and I'm trying to get the script to die when the user closes the window/tab of his browser.

There are several PHP based functions to see if the connection is still open, but none works (trust me, tested them all).

Any creative ideas on how I can do this through the server maybe?

© Server Fault or respective owner

Related posts about apache-2.2

Related posts about ubuntu