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

我一直有问题安装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 

但是我找不到/usr/lib php5-fcgi ,只能find/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缺失,这个问题应该如何解决? 谢谢!! 🙂

你应该把它放回去

 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