Re: How to kill process started by user?
- From: Colin McKinnon <colin.deletethis@xxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jul 2005 09:29:39 +0100
opt_inf_env@xxxxxxxxx wrote:
> Hello,
> Let us suppose that PHP file contains cycle which will never stop. For
> example:
> 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?
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
tricky.
HTH
C.
.
- References:
- How to kill process started by user?
- From: opt_inf_env
- How to kill process started by user?
- Prev by Date: Re: Redirection if a condition is met
- Next by Date: Re: Script preview
- Previous by thread: Re: How to kill process started by user?
- Next by thread: Dynamic Link/Content with PHP
- Index(es):
Relevant Pages
|