在Zeus Web Server配置PHP為Remote Responders
在Zeus Web Server配置PHP為Remote Responders
1.安裝並且啟動zeus web server,廢話~~ 2.編譯php支持fastcgi,建議使用最新release的php,增加--enable-fastcgi來configure 例如: 程式碼:-------------------------------------------------------------------------------- ./configure --enable-fastcgi make make install -------------------------------------------------------------------------------- 3.進入zeus web server的控制台,進入要設定的vhost 下面/usr/local/bin/php不是你的php實際目錄,你可以隨意,但是兩個地方一定要一致 程式碼:-------------------------------------------------------------------------------- 在API Support->FastCGI Configuring FastCGI Remote Responders Adding a FastCGI Remote Responder Directory name: /usr/local/bin/php Location: Machine name: localhost Port: 8002 Additional methods supported?: none -------------------------------------------------------------------------------- 程式碼:-------------------------------------------------------------------------------- 在URL Handling->Handlers->Adding a Handler File Extension: *.php Specify the path and filename of the handler, relative to the document root: /usr/local/bin/php HTTP 404 errors are handled by: The handler -------------------------------------------------------------------------------- 4.在zeus安裝目錄下面的rc.d裡面建一script名字為S05php,並且chmod 755 S05php 程式碼:-------------------------------------------------------------------------------- #!/bin/sh # Script to start and stop the persistent PHP runner for FastCGI. # Please check paths before use. # FastCGI PHP binary FPHPBIN=/usr/local/bin/php # Location to place semaphore SEMFILE=/tmp/php.pid PHP_FCGI_CHILDREN=100 PHP_FCGI_MAX_REQUESTS=1000 export PHP_FCGI_CHILDREN export PHP_FCGI_MAX_REQUESTS # This is Linux - use /proc to increase the local (ephemeral) port range #echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range if [ -z "$ZEUSHOME" ] then cd `dirname $0`/.. ZEUSHOME=`pwd` export ZEUSHOME fi case "$1" in 'start') if [ -e $SEMFILE ] then echo FastCGI PHP error: already running.Restart FastCGI PHP now kill `cat $SEMFILE` sleep 5 fi if [ ! -x $FPHPBIN ] then echo FastCGI PHP error: please check that $FPHPBIN is executable and exists. exit 1 fi echo Starting FastCGI PHP. $ZEUSHOME/web/bin/fcgirunner --user=65534 --group=65534 --pidfile=$SEMFILE 8002 $FPHPBIN ;; 'stop') if [ -e $SEMFILE ] then echo Stopping FastCGI PHP. kill `cat $SEMFILE` rm $SEMFILE exit 0 fi ;; 'restart') if [ -e $SEMFILE ] then echo Stopping FastCGI PHP. kill `cat $SEMFILE` sleep 5 fi echo Starting FastCGI PHP. $ZEUSHOME/web/bin/fcgirunner --user=65534 --group=65534 --pidfile=$SEMFILE 8002 $FPHPBIN ;; *) echo "usage: $0 {start|stop|restart}" ;; esac exit 1 -------------------------------------------------------------------------------- 對上面的script解釋: FPHPBIN=/usr/local/bin/php #設定為php的路徑 SEMFILE=/tmp/php.pid #產生php.pid的路徑,該目錄必須可寫 PHP_FCGI_CHILDREN=100 #php工作數目 PHP_FCGI_MAX_REQUESTS=1000 #每個php的工作在退出前能夠回應的請求數,用於釋放資源 上面兩個根據硬體配置和網站訪問量設定,上面的例子是這裡的設定,預設值是8,500 一般來說 PHP_FCGI_CHILDREN > 訪問並發最大值+10 PHP_FCGI_MAX_REQUESTS 如果設定過小,訪問量大的網站會因為php工作重新啟動頻繁增加負荷 #echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range #只用於linux --user=65534 --group=65534 為php工作執行的用戶和組,一般設定為nobody用戶和組 FreeBSD是65534/65534,Linux是99/99 在zeus目錄下面執行 rc.d/S05php start 5.測試:在你的網站目錄下面建立php測試文件test.php PHP程式碼:-------------------------------------------------------------------------------- <?phpinfo();?> -------------------------------------------------------------------------------- 去訪問這個文件看看是否出了php信息。。。。。。 第三步驟的/usr/local/bin/php不是你的php實際目錄,你可以隨意,但是兩個地方一定要一致 |
所有時間均為台北時間。現在的時間是 08:03 AM。 |
Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2024, Jelsoft Enterprises Ltd.
『服務條款』
* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *