[EMAIL PROTECTED] wrote:
Thanks for replying
I just had the idea (never tried it myself) that you could possibly
fork the request process and let the child process perform the query
It makes perfectly sense to us, but it seems it is only possible to fork
(pcntl_fork) with php running as CGI :(
oops missed that bit in the manual... still ...
if you are using apache then virtual() might offer a solution? (just guessing)
otherwise you might look into writing a little deamon (i.e. a webservice
that only your pages anbd/or scripts can access) which handles running the
queries can be polled as to the status of a query and its result (if finished)
such a deamon would be CLI based and could use process forking to handle
requests to run long queries....
rather than use the <img src="monitorscript.php"> trick you might want to look
'AJAX' on the client side (to do the polling, start the query, etc) in order to
have more control/information on that end.
arnold at helderhosting dot nl
It is not possible to use the function 'pcntl_fork' when PHP is used as
Apache module. You can only use pcntl_fork in CGI mode or from
Using this function will result in: 'Fatal error: Call to undefined
This somehow makes sense, because one would fork the entire apache
Including all the signal handlers, open file handles for log-files and
Furthermore fork is only supported on linux/*nix but not in the windows
world, and it has to be enabled at configure time.
closed and send a second HTTP request to kill the database thread. This
"Stop" button of the browser :(
a daily annoyance. just like its impossible to trap when the window is actually
closed (as opposed to the document merely unloading)
The next idea is to include a <img src="monitorscript.php"> in output
generated by the query script. This should open a second HTTP connection
to the monitor script on most recent browsers. In this script we can
check connection_aborted() and sleep(1) in a while loop without sending
any output. If the connection was aborted, we can kill the corresponding
The remaining problem with that solution is that we also have to detect
when the db query script has terminated and then exit the monitor
script. Otherwise the browser keeps loading that monitorscript and never
This solution has two drawbacks, it work over a http proxy (these tend
to finish queries in order to cache the content) and it works only when
the browser is doing several queries in parallel.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php