When running a long query from PHP, [how] can I kill the query if the user presses stop in their browser?
Take into consideration that I cannot call any other PHP functions because PHP is blocked while waiting for MySQL.
Also I cannot make any more requests to the server (via Ajax) because of session locking.
So one solution could be:
- ignore user abort
- run the long query in the back ground and have PHP check every 100ms if it has finished
- get the pid from the query
- if the user aborts, kill the pid
- else return the result when finished
The 2 thing that I dont know how to do in that is:
- run a non blocking (background) query
- get the pid of a query