PHP mod_fcgi 与 fastcgi_finish_request();

标签 php fastcgi

我想使用 fastcgi_finish_request() 函数。

我在我的服务器上安装了 CPanel,PHP 和 Apache 都是通过它配置的。由于我无法手动编辑 Apache 或 PHP 配置(因为 CPanel),我使用 WHM 中的 easyApache 来构建它以获得 fastcgi。

我看到一个名为 Mod FCGID 的选项,所以我启用了它。

在启用该选项的情况下重建 PHP 和 Apache 后,在调用 fastcgi_finish_request 函数时,我仍然会调用 undefined function

最佳答案

有点晚了,但对人们来说是个好消息。根据我使用 PHP 5.5.7 的经验。

PHP 使用 mod_php(标准 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 mod_fcgi 与 fastcgi_finish_request();,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12982964/

相关文章:

php - 服务器不从 rss xml feed 导入图片

fastcgi - 如何在 Windows 上手动启动 fastCGI 应用程序?

php - 服务器恢复后 502 Bad Gateway Nginx

python - 共享主机上带有 FastCGI 的 CherryPy(或其他 Python 框架)

php - 在 webdriver 中呈现 HTML 字符串或本地 html 文件

php - 更新动态页面的标题

php - 选择正在传递的项目值而不是文本值到mysql数据库实时成本计算

PHP CSS Color Shuffle 数组?

c++ - 用于 C++ 的 FastCGI

php - 使用 php 样式提取 P 标签之间的数据