本节分享的这段shell 脚本可以运行Apache 2.x的mod_fastcgi的。
本例中用到的Apache2.2,在FreeBSD系统中以源代码方式安装。
该脚本在FreeBSD及Debian / RHEL/ CentOS中测试通过。
1,
安装完成后,将php.ini放在cgi-bin目录中,然后设置权限。
配置的mod_fastcgi的httpd.conf如下:
复制代码 代码示例:
<VirtualHost *:80>
ServerAdmin webmaster@jb200.com
DocumentRoot "/websites/home/jb200.com.com/http"
ServerName jb200.com.com
ServerAlias www.jb200.com.
ErrorLog "/websites/home/jb200.com.logs/error.log"
CustomLog "/websites/home/jb200.com/logs/access.log" common
ScriptAlias /cgi-bin/ "/websites/home/jb200.com/cgi-bin/"
<Directory "/websites/home/jb200.com.com/http">
Options -Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php.cgi
Order allow,deny
Allow from all
</Directory>
<Directory "/websites/home/jb200.com/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#SuExecUserGroup jb200.comUser jbxueGroup
</VirtualHost>
2,shell脚本
复制代码 代码示例:
#!/bin/sh
#
# Apache 2.x中运行 PHP5 中的 mod_fastcgi
### Set PATH ###
PHP_CGI=/usr/local/bin/php-cgi
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
### no editing below ###
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI