How to kill php connection from client side?
I am using jquery with php.
On the client side the user can close the dialogbox or it will stop ajax request due to the time-out limit.
The problem is the mysql is still continue the process which is in the "sending data state". But the php process no longer available because of:开发者_如何学运维
set_time_limit(20);
Are there way to kill the PHP::PDO connection with mysql process?
Thanks Arman.
Sounds like you're using persistent database connections. With those, the connection from mysql<->php is kept alive regardless of whether a client is actually connected or not. This allows queries to keep running and keeps any variables, locks, temporary tables, etc... to stay alive and gum up the works.
Disable persistent connections, and your 'stuck' queries will die when the client disconnects and PHP cleans up afterwards.
精彩评论