1,启动和控制

/etc/rc.d/init.d/lighttpd start [stop] [restart]

2,如果没有启动起来,手工命令行敲一下:

/usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

根据提示处理。

3,如果是提示关于{ 之类符号的,很可能是perl没有起作用。configure的–with-pcre,如果找不到pcre-devel是不报错的。rpm -q pcre-devel 看一下就知道了。

安装PHP:

官方下载PHP,configure 时候加上:’–enable-fastcgi’ ‘–enable-force-cgi-redirect’ ‘–enable-discard-path’,其他按实际需要。

我的例子:’./configure’ ‘–prefix=/usr/local/php’ ‘–with-gd’ ‘–with-mysql’ ‘–with-zlib’ ‘–with-freetype-dir=/usr/local/lib’ ‘–with-jpeg-dir=/usr/lib’ ‘–with-iconv’ ‘–with-curl’ ‘–enable-fastcgi’ ‘–enable-force-cgi-redirect’ ‘–enable-discard-path’

注意: 不能有’–with-apxs=/www/bin/apxs’之类的。

检查一下是否正确:/usr/local/php/bin/php -v

如果有(cgi-fcgi) 则安装正确,如果是(cli)那就没有安装对。

最好安上eaccelarator,教程很多,不累述。
调整lighttpd配置:

server.modules = (
“mod_rewrite”,
“mod_redirect”,
# “mod_alias”,
“mod_access”,
“mod_status”,
# “mod_setenv”,
“mod_fastcgi”,
# “mod_proxy”,
“mod_simple_vhost”,
# “mod_cgi”,
“mod_compress”,
“mod_expire”,
“mod_accesslog” )

fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/local/php/bin/php”
)
)
)

复制安装目录下的文件:

cp spawn-php.sh /usr/local/lighttpd/bin/

调整设置:

cd /usr/local/lighttpd/bin
vi spawn-php.sh

修改下述变量为正确值:

SPAWNFCGI=”/usr/local/lighttpd/bin/spawn-fcgi”
FCGIPROGRAM=”/usr/local/php/bin/php”
FCGI_WEB_SERVER_ADDRS=”192.168.133.17″
USERID=nobody
GROUPID=nobody

运行一次:

[bin]$ ./spawn-php.sh
spawn-fcgi.c.207: child exited with: 0, Success

成功了,启动lighttpd
[bin]$ /etc/rc.d/init.d/lighttpd start
OK !