带有fastcgi_finish_request()的PHP mod_fcgi;

CJ *_*lti 3 php fastcgi

我想使用这个fastcgi_finish_request()功能.我在我的服务器上安装了cpanel,PHP和Apache都是通过它配置的.由于我无法手动编辑apache或PHP(因为cpanel),我在WHM中使用easyApache来构建它以获得fastcgi.我看到了一个选项caleld Mod FCGID所以我检查了它.在选中了该选项重建PHP和apache之后,我仍然在调用完成请求函数时调用未定义的函数.

小智 10

有点晚了,但人们的信息很好.根据我使用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.
Run Code Online (Sandbox Code Playgroud)

对于使用fastCGI和PHP_FPM的PHP:

// your code here

fastcgi_finish_request();

// run other process without the client attached.
Run Code Online (Sandbox Code Playgroud)

请注意,对于我们来说,执行fastcgi_finish_request()后,log_error不再起作用.我认为这是因为与Apache的连接也被切断,它无法与fastCGI通信以记录错误.


dev*_*ler 7

fastcgi_finish_requestPHP-FPM SAPI特定功能,在标准php-fcgi二进制文件中不可用(由Apache [mod_fcgid,mod_fastcgi],nginx,lighttpd等使用).