Problem:
I have a webserver, which is mostly php and every page is dynamicly created with php. On one page I have a php script, that a user can start, which runs for 2-3 minutes until its finished. The problem here is: The script does not finish, when the user decides to switch pages on the website or does anything else, that starts annother php script.
is there any way to force a php script to run until its finished, even if other php scripts are started?
2
Answers
Use ignore_user_abort, more info found here: https://www.php.net/manual/en/features.connection-handling.php
There is a solution built into PHP:
https://www.php.net/manual/en/function.ignore-user-abort.php
You can simply call this:
ignore_user_abort(true);
This
ignore_user_abort
setting is also one which you can apply using the php.ini or .htaccess files.