只是讓我說我是FastCGI的新手。我在我的OS X機器上安裝了MAMP的Apache。默認的PHP處理程序是Apache Handler 2.0
(libphp5.so)。我想改變到FastCGI
這裏遵循的答案:How to configure Apache to run PHP as FastCGI on Ubuntu 12.04 via terminal?Apache FastCGI PHP中的FastCgiExternalServer和FastCgiServer之間的區別?
我說在我的httpd.conf的末尾以下內容:
<IfModule mod_fastcgi.c>
AddHandler php5.fcgi .php
Action php5.fcgi /php5.fcgi
Alias /php5.fcgi /Applications/MAMP/fcgi-bin/php5.fcgi
FastCgiServer /Applications/MAMP/fcgi-bin/php5.fcgi -socket /Applications/MAMP/tmp/php-fcgi/php5-fpm.sock -pass-header Authorization -idle-timeout 3600
#FastCgiExternalServer /Applications/MAMP/fcgi-bin/php5.fcgi -socket /Applications/MAMP/tmp/php-fcgi/php5-fpm.sock -pass-header Authorization -idle-timeout 3600
<Directory /Applications/MAMP/fcgi-bin>
Order allow,deny
Allow from all
</Directory>
</IfModule>
然而,正如你所看到的,FastCgiExternalServer
被註釋掉了。相反,我不得不使用FastCgiServer
原因,否則阿帕奇試圖請求一個頁面時,是給我以下錯誤:
[週五05月06日23時25分22秒2016年] [錯誤] [客戶:: 1]( 2)沒有這樣的文件或目錄:FastCGI:無法連接到服務器「/Applications/MAMP/fcgi-bin/php5.fcgi」:連接()失敗
[Fri May 06 23:25:22 2016] []錯誤] [客戶端:: 1] FastCGI的:不完全的報頭(0字節)從服務器 「/Applications/MAMP/fcgi-bin/php5.fcgi」
但是/Applications/MAMP/fcgi-bin/php5.fcgi
存在並且其內容接收是:
#!/bin/bash
PHP_CGI=/Applications/MAMP/bin/php/php5.6.2/bin/php-cgi
exec $PHP_CGI
什麼FastCgiServer
和FastCgiExternalServer
,爲什麼FastCgiExternalServer
沒有我的情況,但FastCgiServer
工作的工作有什麼區別?
如果你在2016年做PHP的FastCGI,看mod_proxy_fcgi和PHP-FPM代替的mod_fastcgi。 – covener