Im running Apache 1.3 and PHP 4.3.  PHP is running as a module in apache, I
have code doing something along the following lines

set_time_limit( 0 );
while( true )
{
    // Do something that may take hours to return
}

What I hoped would happen (as ignore_user_abort is false) would be that when
I hit stop on the browser (IE), the PHP module woudl realise the connection
was dead and abort my script.

This is exactly the behaviour I want, but it dose NOT work.

I even tried the following (less than ideal) as a work around.

set_time_limit( 0 );
while( connection_aborted() == false )
{
    Sleep( 1 );
    // Do something that takes slightly less time than before
}

This also dosent work, Im guessing (from the manual) this is due to the fact
that connection_aborted only detects the abort when you send something to
the browser.  As I dont want to send anything this is a problem, this method
is also less than idea as i can not sleep for less than 1 second (win32
server).

My question is ... Can I make/force PHP to give me the behaviour I want. ie.
killing the script the moment the server detects the browser has closed its
connection.

If this is impossible (I'd be interested to know why) can i make
connection_aborted detect the browser closing the connection without sending
needless data to the client.

Many thanks

Rich





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to