example of how to use fastcgi_finish_request()

I understand that basically I can call fastcgi_finish_request(); and then continue executing PHP script.

Yes, that’s all you have to do.

$obj = new controller();
echo $o->getResult();
fastcgi_finish_request();
do_facebook_thing();

To convince yourself it is working, do this:

echo "Test";
fastcgi_finish_request();
sleep(10);

If you remove the second line, then you will see that the browser has to wait 10 seconds.

Leave a Comment