• SupportPHP
  • finish execution of the script via popen even if the browser tab closes

If I have this on my webpage :

$f = popen("/home/username/bin/something --json arg1 arg2", "rb");
while (($line = fgets($f)) !== false) {
    $event = json_decode($line);
    // do something
}
fclose($f);

If the the browser closes unexpectedly, will the execution of /home/username/bin/something stop ? I need it to be finished even if the browser tab closes.

Mastodon