Apache-2.2

無法在 Apache 上安裝 PHP-FPM(無法連接到 FastCGI 伺服器)

  • October 12, 2012

我一直在安裝php-fpmapache2-mpm-worker. 這是我正在遵循的指南。

根據指南的第 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-cgiand /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會失去,應該如何解決這個問題?謝謝!!:)

你應該把它重新設置為

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

引用自:https://serverfault.com/questions/437514