Reputation: 2790
I need to stop the process of the "killed" request.
It's possible? The user request and before this process end the user just go to other page, so the last request need stop.
I think my answer is somewhere with register_shutdown_function and fastcgi_finish_request. But i don't have sure if its the answer, and haven't success to figure it out.
Some php expert can help?
Appreciate in advance.
Upvotes: 0
Views: 115
Reputation: 67
what you need is not fastcgi_finish_request or register_shutdown_function hope this can help you : a.php
<?php
$pid = getmypid();
file_put_contents("/home/longan/pid", $pid, LOCK_EX);
while(1) {
sleep(1);
file_put_contents("/home/longan/a.txt", "abc", FILE_APPEND | LOCK_EX);
}
b.php
<?php
echo "i will kill a.php!";
$pid = file_get_contents("/home/longan/pid");
posix_kill($pid, SIGTERM);
Upvotes: 2