mickyt Posted March 8, 2007 Share Posted March 8, 2007 Hi, I'm relatively new to PHP (also new here), but have already tried varies places for help. This is my problem: running PHP5 under Apache 2.2 (prefork) as module, I call a Python script that does a sometimes lengthy MySQL query, using parameters supplied by the browser client. When the query takes too long, the user may want to press the STOP button and issue a different query. But the previous child process will run to completion in any case, wasting server resources at the very least. In the current setting there seems to be no way to forward the user action to kill the child process. The system() call is blocking, and the only chance to see the closed connection in the PHP script is after it has returned. Is there a work-around? I'm advised not to use the pcntl_fork() etc. in embedded PHP. Are there other possibilities? Please don't say I should have done everything directly in PHP, without a system() call. I'm much better in Python, that's the reason why, and also I think the call to execute_query (or whatever it is called) directly from within PHP will block as well. Any suggestions, best proven real-life solutions, are welcome. I thought this must be an everyday problem, or? Thanks for your help Michael Link to comment https://forums.phpfreaks.com/topic/41788-how-can-i-kill-a-running-child-process-when-client-closes-connection/ Share on other sites More sharing options...
effigy Posted March 8, 2007 Share Posted March 8, 2007 Try ignore_user_abort. Link to comment https://forums.phpfreaks.com/topic/41788-how-can-i-kill-a-running-child-process-when-client-closes-connection/#findComment-202653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.