Answer the question
In order to leave comments, you need to log in
How to stop php execution when a request is terminated?
Hello! I have a backend (php-fpm + nginx) and mobile clients.
Judging by the nginx logs, quite often a situation occurs when either the Internet is cut off for clients, or the request is canceled by themselves. At the same time, the php script continues to perform the action.
I would like to stop it (there is no logic there, just a call to the strange api) when the client falls off. Can this be done somehow?
Answer the question
In order to leave comments, you need to log in
There is a function in php: ignore_user_abort(): php.net/manual/function.ignore-user-abort.php
And the corresponding option in php.ini
Should help.
UPD.
Section in the php documentation: php.net/manual/features.connection-handling.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question