我想使用fastcgi_finish_request()函数.我在我的服务器上安装了cpanel,PHP和Apache都是通过它配置的.由于我无法手动编辑apache或PHP(因为cpanel),我在WHM中使用easyApache来构建它以获得fastcgi.我看到了一个选项caleld Mod FCGID所以我检查了它.在选中了该选项重建PHP和apache之后,我仍然在调用完成请求函数时调用未定义的函数.
解决方法:
有点晚了,但人们的信息很好.根据我使用PHP 5.5.7的经验.
PHP使用php_mod(标准Apache)
ob_start();
header("Connection: close\r\n");
header('Content-Encoding: none\r\n');
// your code here
$size = ob_get_length();
header("Content-Length: ". $size . "\r\n");
// send info immediately and close connection
ob_end_flush();
flush();
// run other process without the client attached.
对于使用fastCGI和PHP_FPM的PHP:
// your code here
fastcgi_finish_request();
// run other process without the client attached.
请注意,对于我们来说,执行fastcgi_finish_request()后,log_error不再起作用.我认为这是因为与Apache的连接也被切断,它无法与fastCGI通信以记录错误.
标签:php,fastcgi
来源: https://codeday.me/bug/20190712/1444218.html