We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Can I use fastcgi_finish_request() with Phalcon and how ?

I'd like to use fastcgi_finish_request() (link) to return content to a user but do some additional work befor the script finishes. Is there a way to do it in Phalcon and how?



98.9k

If you want to do extra jobs after sending the output the better place would be after echoing the response:


echo $application->handle()->getContent();
fastcgi_finish_request();

// process extra work here

Thanks for response.

Can you tell me what is actually happening in the framework afer I echo a string in my controller? Is it documented somewhere?



98.9k

The framework has finished its execution, with the output transfered to the CGI you can perform aditional tasks after that.