How to kill process started by user?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Let us suppose that PHP file contains cycle which will never stop. For
while ( 2==2 )
       some usage of database;
User which opens this PHP page runs time consuming execution of the
cycle. My question is whether this execution will be automatically
stopped after user closes the PHP file (or closes his browser). I
suppose that answer is "No", since PHP is server-side application.
How than I can find such processes and kill them by hands?

Re: How to kill process started by user? wrote:
Quoted text here. Click to load it

What operating system is the server running?


Re: How to kill process started by user? wrote:

Quoted text here. Click to load it

Every so often PHP will check to see how long it has been executing and
whether the user has disconnected. You can explicitly control the behaviour
of PHP in this regard. However as you allude to, if PHP is waiting for
information (e.g. from a database query) these checks are not carried out.
IME memory usage behaves similarly, at least with the mysql extension.

So really this leaves two problems:

1) identifying when it happens
2) killing the process when it does

But these are very much dependent on the operating system, the webserverand
the level of access you have. On my machines (Linux) I have root access and
a cron job which runs every 5 minutes to check for apache processes
(mixture of 1.3 and 2.0 with seperate processes) using lots of memory by
parsing the output of the ps command. When it finds one it sends a HUP. If
you're using IIS or don't have root access, life is likely to be a lot more



Site Timeline