tags:

views:

54

answers:

4

I mean, if a php script/page is invoked by a browser and page load/execution is interrupted by user or by browser crash, does script execution continues on the server side?

+7  A: 

yes, unless you call ignore_user_abort() first. http://php.net/manual/en/function.ignore-user-abort.php

Mike Sherov
You may also change default behavior in config file: http://pl.php.net/manual/en/misc.configuration.php#ini.ignore-user-abort
Kamil Szot
Great! Thanks a lot!
Riccardo
@Riccardo, no problem!
Mike Sherov
A: 

Depends on ignore_user_abort() setting

Kamil Szot
A: 

Depends on ignore_user_abort(). But if you have some loop or poorly written code, it will run until script timeout / max execution time has been reached (~30 seconds).

Jason McCreary
A: 

You can test this very easily:

echo "sleeping 10 seconds...";
sleep(10); //close your browser at this point
error_log("i'm still here!");

Just check your web server error log for the output.

joeynelson