FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

how to make Php process won't stop after user disconnect.

 


Philip
I have a problem that like this below.
when i try to process a php that have many2x and big function that about take 1 hours,

like www.google.com/progess.php
but it seem if my browser stop or my connection disconnect that make the progess stoped too also.

i know there is a function settimeout(0);
but it;s still useless if the user disconnect -_-"

is there a way to php process wont stop if a user disconnected ?

thanks,
hexkid
Philip wrote:
is there a way to php process wont stop if a user disconnected ?


http://www.php.net/manual/en/features.connection-handling.php
Philip
so is i am not wrong
just use this function ignore_user_abort();

there is 3 state
ignore_user_abort(0) ;<-- time out and abort / Normal
ignore_user_abort(1) ;<-- abort after disconnect
ignore_user_abort(2) ;<-- abort only if timeout

and for better just using number (2) right ??

thanks
hexkid
Philip wrote:
so is i am not wrong
just use this function ignore_user_abort();

there is 3 state
ignore_user_abort(0) ;<-- time out and abort / Normal
ignore_user_abort(1) ;<-- abort after disconnect
ignore_user_abort(2) ;<-- abort only if timeout

and for better just using number (2) right ??


The state you check with connection_status(); to have the script continue after a user clicked "Stop" execute a
Code:
ignore_user_abort(true);


PS. 2 when interpreted as a boolean is the same as true, so calling ignore_user_abort(2) or ignore_user_abort(true) is the same; but I prefer the last.
Philip
err.. i what happened if there i set settimeout(0); 'unlimted and ignore_user_abort (2); and there is a progess that won;t end ??
hexkid
Philip wrote:
err.. i what happened if there i set settimeout(0); 'unlimted and ignore_user_abort (2); and there is a progess that won;t end ??

Probably the hosting administrator will cancel your account Wink
Philip
hehe, that cannot be. that too cruel ^_^"
btw thanks to hex-kid Smile
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.