无法在 Apache 上安装 PHP-FPM(无法连接到 FastCGI 服务器)

无法在 Apache 上安装 PHP-FPM(无法连接到 FastCGI 服务器)

php-fpm我在安装使用时遇到了问题apache2-mpm-worker。T这是导游我正在关注。

根据指南的第 5 步,

Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization

但是我找不到,而只能找到php5-fcgi和,我不确定它们是否相同。/usr/lib/usr/bin/php5-cgi/usr/bin/php-cgi

因此我将步骤 5 中的代码改为:

Alias /php5-fcgi /usr/bin/php5-fcgi
FastCgiExternalServer /usr/bin/php5-fcgi -host 127.0.0.1:9000 -pass-header

重新启动 Apache 时,它​​的日志出现以下错误:

[notice] caught SIGTERM, shutting down
[alert] (4)Interrupted system call: FastCGI: read() from pipe failed (0)
[alert] (4)Interrupted system call: FastCGI: the PM is shutting down, Apache seems to have disappeared - bye
[notice] Apache/2.2.22 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations
[notice] FastCGI: process manager initialized (pid 16348)

并加载索引页

[error] [client 10.0.2.2] (111)Connection refused: FastCGI: failed to connect to server "/usr/bin/php5-cgi": connect() failed
[error] [client 10.0.2.2] FastCGI: incomplete headers (0 bytes) received from server "/usr/bin/php5-cgi"
[error] [client 10.0.2.2] File does not exist: /var/www/mydomain/public/favicon.ico

问题:知道为什么php5-fcgi会缺失吗?如何修复此问题?谢谢!!:)

答案1

你应该把它设置回

Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi

它不存在,因为下一行拦截了该调用并将其转发给 fpm

FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization -idle-timeout 3600

相关内容