Riccardo
Riccardo

Reputation: 71

Does browser stop/crash halts script execution?

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?

Upvotes: 6

Views: 1606

Answers (4)

joeynelson
joeynelson

Reputation: 405

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.

Upvotes: 0

Jason McCreary
Jason McCreary

Reputation: 72991

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).

Upvotes: 1

Kamil Szot
Kamil Szot

Reputation: 17817

Depends on ignore_user_abort() setting

Upvotes: 1

Mike Sherov
Mike Sherov

Reputation: 13427

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

Upvotes: 14

Related Questions