How to kill a PHP process?

Is it possible to tag a PHP process and kill it if necessary?

Why? I have a jQuery application, when the user "saves", the POST is sent to my PHP script. The PHP script is quite intense and may take some time, but the processing is done on the server behind the scenes and is transparent to the user (when I say "transparent", I mean that the user can do things in jQuery on the front panel, and you don’t understand that PHP script is still being processed). Thus, it is possible that the user will save again before the completion of the first PHP save operation.

So my question is: how can I kill the last PHP save process (if it is not finished yet) and start the save process again?

+4
source share
1 answer

As for assistance in this particular matter, I will say that the first approach is wrong. Your data or transaction will become inconsistent. Therefore, the solution should be the first in the PHP PDO to complete the transaction. The advantage would be that if the process fails between transactions, you can go back.

The second in jquery uses the $ .ajaxComplete () method to view any future event. let the handler see that the task is completed and inform the user about its status.

I can give examples if you need

-1
source

All Articles