note 109694 deleted from function.register-shutdown-function by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Aug 2012 16:05:09 +0000 |
| Subject: | note 109694 deleted from function.register-shutdown-function by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189986@lists.php.net to get a copy of this message | ||
Note Submitter: Kokuswolf
----
In addition to what alexyam explained here is an another way:
If you call this at the beginning...
<?php
register_shutdown_function(function(){
fastcgi_finish_request();
});
?>
... you will be able to use shutdown_functions in a normal way (with exit) since
register_shutdown_functions put these callbacks on a stack. So this first one forces php-fpm to stop
the response output, but the script stay alive:
<?php
register_shutdown_function(function(){
fastcgi_finish_request();
});
register_shutdown_function(function(){
sleep(10);
echo "You can't see this and you don't have to wait for this";
});
?>