(connection_aborted not working)
I had this problem years ago, now the problem came back after upgrading php... i tried everything i found and in the end the function ob_end_flush(); on top of script as post in php bug track solved the problem. Im using windows 7 x64 / php 5.2.4 / apache 2.2.14 (win32)
try adding ob_end_flush(); on top of you script.
i read something about this but can't remember where, it was related to a bug or something.
hope this help.
connection_aborted
(PHP 4, PHP 5)
connection_aborted — Verifica se o cliente está desconectado
Descrição
int connection_aborted
( void
)
Verifica se o cliente está desconectado.
Valor Retornado
Retorna 1 se o cliente está desconectado, 0 caso contrário.
Veja Também
- connection_status() - Retorna o status da conexão
- ignore_user_abort() - Estabelece se acontecerá o encerramento do script quando o usuário abortar a conexão
- Tratamento de conexões para um descrição completa sobre tratamento de conexões no PHP.
connection_aborted
rickyale at ig dot com dot br
13-Nov-2009 05:49
13-Nov-2009 05:49
phpcoder at cyberpimp dot techlab dot info
27-Jun-2007 04:50
27-Jun-2007 04:50
Although the documentation indicates it returns an int, I found comparing the return value with numeric values does not seem to work.
Example (does not work):
<?php
if (connection_aborted()==1) {
fwrite($filehandle, 'aborted!');
}
?>
You're better off just assuming it returns boolean
Example (does work):
<?php
if (connection_aborted()) {
fwrite($filehandle, 'aborted!');
}
?>
rickyale at ig dot com dot br
13-Dec-2002 10:29
13-Dec-2002 10:29
I know why nobody can use the functions connection_XXX(). If the php code do not send anything to buffer, the php dont check the connection, so, the connection_timeout will still NORMAL and will not be ABORTED.
Ex
<?php
Set_Time_Limit(0); //this you know what gonna do
Ignore_User_Abort(True); //this will force the script running at the end
While(!Connection_Aborted()) {
Echo "\n"; //this will save de while
Flush(); //Now php will check de connection
While(CONDITION) {
Echo "My chat....";
}
Sleep(1);
}
?>
end
