Re: Does apache stop a script mid execution ?
- From: The Natural Philosopher <a@xxx>
- Date: Tue, 22 Jul 2008 16:32:15 +0100
arkascha wrote:
The Natural Philosopher wrote:
arkascha wrote:Guillermo Antonio Amaral Bastidas wrote:that is interesting and worth knowing.
Hi everybody,Yes, it DOES stop the execution.
I have a quick and probably dumb question, keep in mind I just
dumped my old love FastCGI + Perl for it's younger hotter friend PHP5.
If the user calls a time consuming script and then stops or refreshes
the browser before the script had time to finish will Apache kill the
script mid execution or will it let it finish ?
I ask this stupid question because this seems to be happening in one
of my sites.
If this is true, is there any way to tell apache to finish what it
was doing ?
That is usually the desired behaviour, since you dont want to spend all
the valuable cpu ressource to produce a result noone is ever going to see
anyway because the client has gone away.
However you can change this behaviour: take a look at the
ignore_user_abort function
How does it relate to e.g. a script performing a large mysql query?
Hm, interesting question...
I'd say "depends, actually", since it depends, actually :-)
It should depend on two things: 1.) the way you use php in your environment
2.) the way the client is implemented in the php mysql extension and 2.b) how the connection is set up.
In case you use php as cgi-executable the whole process is stopped in case
the server stops the script execution. This means the client (the process)
disconnects from the mysql server which drops the query, unless there is
some hidden feature in mysql you can use to prevent this (I don't know
about that).
Opposed to that if you use php as an apache module (more common nowadays)
the process is usually _not_ terminated but serves subsequent requests to
the http server (unless its maximum request or duration limits have been
reached which is unlikely). In this case it depends on how the mysql
connection is held. I'd say (note: I dont know) that in case of a "normal"
connection the script abortion triggers the connection to be dropped, this
the query to be dropped by the mysql server, just as if you use a command
line client and disconnect during a query (CTRL-C).
That seems to be the way it would work, that the calling library would exit, and close the socket to the server..would that abort the server activity/process though?
If, however, you use a
persistent connection (mysql_pconnect() or something close to that) I'd
say that the connection is _not_ dropped, and I am not sure if there is any
mechanism to notify the server that the query is meant to be cancelled. It
should be possible however, since you can do that when using the command
line client...
Have a try and tell us...
No sure how I'd even try.
.
arkascha
- References:
- Does apache stop a script mid execution ?
- From: Guillermo Antonio Amaral Bastidas
- Re: Does apache stop a script mid execution ?
- From: arkascha
- Re: Does apache stop a script mid execution ?
- From: The Natural Philosopher
- Re: Does apache stop a script mid execution ?
- From: arkascha
- Does apache stop a script mid execution ?
- Prev by Date: Re: notice and warning
- Next by Date: Re: notice and warning
- Previous by thread: Re: Does apache stop a script mid execution ?
- Next by thread: Re: Does apache stop a script mid execution ?
- Index(es):
Relevant Pages
|
|