二、接着安装php
tar zxf php-5.2.4.tar.gz
cd php-5.2.4
./configure
--prefix=/usr/local/php-fcgi
--enable-fastcgi
--enable-force-cgi-redirect
--without-iconv
--enable-mbstring
--with-mysql=/usr/local/mysql
make
make install
复制参数文件到目标目录:
cp php.ini-dist /usr/local/php-fcgi/lib/php.ini
检查fast-cgi是否安装成功可以运行如下命令
/usr/local/php-fcgi/bin/php-cgi -v
显示如下信息,内容里包含“PHP 5.2.4 (cgi-fcgi)"表示支持fast-cgi了
PHP 5.2.4 (cgi-fcgi) (built: Oct 28 2007 20:08:41)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
三、最后安装lighttpd
1.安装配置lighttpd
1.1 首先创建运行lighttpd的用户和组
# groupadd lighttpd
# useradd -g lighttpd -s /sbin/nologin -d /dev/null lighttpd
1.2 开始安装lighttpd
# wget http://www.lighttpd.net/download/lighttpd-1.4.8.tar.gz
# tar -zxvf lighttpd-1.4.8.tar.gz
# cd lighttpd-1.4.8
# ./configure --prefix=/usr/local/lighttpd
# make
# make install
# mkdir /usr/local/lighttpd/conf
# mkdir /usr/local/lighttpd/log
# mv ./doc/lighttpd.conf /usr/local/lighttpd/conf/
# cp ./doc/rc.lighttpd.redhat /etc/init.d/lighttpd
vi conf/lighttpd.conf
将 #”mod_fastcgi”, 的#去掉
server.modules = (
"mod_rewrite",
"mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
"mod_fastcgi",
找到fastcgi的定义
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/local/php-fcgi/bin/php-cgi"
)
)
)
一开始我把配置写"bin-path" => "/usr/local/php-fcgi/bin/php"这样,发现报错,后来改了下以上的配置,发现OK了!
启动lighttpd命令是这样的:
/usr/local/lighttpd/sbin/lighttpd -f conf/lighttpd.conf
最后可以在程序目录下建个test.php,检查一下是否正常!
资料引用:http://www.mypchelp.cn/399642.html
标签: