为lighttpd的php-fcgi写一个启动脚本,这样每次重启之后就不用自己手动把php-fcgi跑起来了。
编辑/etc/init.d/php-fcig,内容如下:
#! /bin/sh # ### BEGIN INIT INFO # Provides: php-fcgi # Required-Start: network # Required-Stop: lighttpd # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: Start the php-fcgi ### END INIT INFO . /etc/rc.status case "$1" in start) echo -n -e "Starting php-fcgi\t" /usr/bin/spawn-fcgi -f /usr/bin/php-cgi -p 2000 -a 127.0.0.1 -C 8 rc_status -v ;; stop) echo -n -e "Stopping php-fcgi\t" startproc /usr/bin/killall php-cgi rc_status -v ;; restart) $0 stop $0 start ;; status) echo -n -e "Checking for service php-fcgi\t" checkproc -k /usr/bin/php-cgi rc_status -v ;; *) echo "Usage: $0 {start | stop | status}" exit 1 ;; esac rc_exit
然后执行
chmod +x /etc/init.d/php-fcgi chkconfig php-fcgi on
然后编辑lighttpd的配置文件,加入:
fastcgi.server = ( ".php" => (( "host" => "127.0.0.1", "port" => "2000", )))
完成。