Q:安裝mod_fastcgi時出現如下錯誤:
root@mail mod_fastcgi-2.4.2]# make top_dir=/etc/httpd install
Makefile:12: /etc/httpd/build/special.mk: No such file or directory
make: *** No rule to make target `/etc/httpd/build/special.mk'. Stop
.......
A:#40樓,感謝kelphon 提供:http://www.extmail.org/forum/thread-2243-3-5.html
原因是默認的/etc/httpd/build/目錄不存在
解決方法1, 安裝httpd-devel包 yum install httpd-devel
解決方法2, 對應於apache2.2的fastcgi2.4.2的版本不支持2.2
最新的mod_fastcgi2.4.2並沒有針對apache2.2作相應的修改,主要是apache2.2的lib名稱前綴改爲apr_,之前的是ap_。在網上找到一個mod_fastcgi的patch:http://www.fastcgi.com/archives/ ... ecember/004056.html 運行一下就可以了。
揭開mod_fastcgi的tar,裏面有個Makeinstall.AP2,改名爲Makeinstall並修改裏面的apache相關路徑,注意把apxs和apachectl的路徑改成絕對路徑,寫完整,因爲apache2.2跟apache2的目錄結構有所不同,因爲這個,害得我改了鬱悶了好幾天。
可以自行修改Makefile來解決
# Makefile for Apache2
#
builddir = .
# XXX change this line
top_dir = /usr/share/apache2
top_srcdir = ${top_dir}
top_builddir = ${top_dir}
include ${top_builddir}/build/special.mk
APXS = apxs
APACHECTL = apachectl
#DEFS=-Dmy_define=my_value
#INCLUDES=-Imy/include/dir
#LIBS=-Lmy/lib/dir -lmylib
# XXX add this line
INCLUDES=-I /usr/include/apache2 -I /usr/include/apr-0
all: local-shared-build
install: install-modules
clean:
-rm -f *.o *.lo *.slo *.la
[補充內容]
對於更新的版本,安裝方法有些簡單的變化:
#wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
#tar xvfz mod_fastcgi-2.4.2.tar.gz
#cd mod_fastcgi-2.4.2
./configure.apxs
make
make install
如果默認情況下,找不到apxs路徑,則指定apxs的絕對路徑,通過以下方式可以查到:
# rpm -ql httpd-devel
查到路徑如下:
/usr/lib/httpd/build/special.mk #該死的special.mk,在httpd-devel包裏,未安裝httpd-devel前,則無法找到而導致安裝fcgi失敗。
/usr/sbin/apxs
接着重新安裝:
#APXS=/usr/sbin/apxs ./configure.apxs #一路順利安裝
#make
#make install
而安裝perl-FCGI則簡單得多,直接下命令(CentoS)
#yum -y install perl-FCGI