Imagine someone drops an HTTP request to a PHP script while it’s executing (e.g., the script has received all the GET and POST data and is currently processing, and the user closes their browser window).
How can I make sure PHP keeps executing until the script finishes as if the client never quit the connection?
Use
ignore_user_abort(TRUE).http://www.php.net/manual/en/function.ignore-user-abort.php
You can also set this in php.ini. Also, don’t forget
set_time_limit(0)if applicable, so your script doesn’t timeout.