FreeBSD Configure Apache 2.2 PHP with FastCGI…

2009-05-13 13:39:38来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

Q.I'd like to switch from mod_php5 to mod_fastcgi. I'm using
[url=javascript:;]FreeBSD[/url]
7 release along with following software:
+
[url=javascript:;]Apache[/url]
2.2
+
[url=javascript:;]PHP[/url]
as mod_php5
+ MySQL DB 5.1.23 server
How do I configure php as
[url=javascript:;]FastCGI[/url]
server?
A.mod_fcgid has a newprocess management strategy, which concentrates on reducing the numberof fastcgi server, and kick out the corrupt fastcgi server as soon aspossible. It is abinary compatibility alternativeto Apache
[url=javascript:;]module[/url]
mod_fastcgi;  so your existing fastcgi programs do not need to be recompiled. mod_fcgid supports suEXEC.
Why run PHP5 as
[url=javascript:;]mod_fcgi[/url]
/ mod_fastcgi?FastCGI as has some serious advantages over mod_php5:

  • You can do user level separations. You can enable quotas per user. Limit users by processes and CPU consumption.
  • chroot security call per user possible
  • According to several reports fastcgi works much faster than mod_php and cgi mode.
Step # 1: Install mod_fcgidMake sure your
[url=javascript:;]ports[/url]
are upto date:
# portsanp fetch update
Install mod_fcgid:
# make install clean
Make sure php supports FastCGIMake sure php-cgi binary exists and it is compiled with fastcgi support:
# cd /usr/ports/lang/php5
# make showconfig | grep -i FASTCGI
Output:
FASTCGI=on "Enable fastcgi support (CGI only)"Another way to test fastcgi support, enter:
# /usr/local/bin/php-cgi -v
Output:
/usr/local/bin/php-cgi -v
PHP 5.2.5 with Suhosin-Patch 0.9.6.2(cgi-fcgi)(built: Mar  6 2008 09:15:41)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
If you don't see word cgi-fcgi, recompile php with fastcgi support by visiting /usr/ports/lang/php5
# cd /usr/ports/lang/php5
# make config
# make install clean
Step # 3: Load mod_fcgi moduleOpen your httpd.conf file located at /usr/local/etc/apache22/ directory:
# vi /usr/local/etc/apache22/httpd.conf
Load mod_fcgi module:
LoadModule fcgid_module libexec/apache22/mod_fcgid.so
Configure mod_fcgi
   AddHandlerfcgid-script.fcgi
    FCGIWrapper /usr/local/bin/php-cgi .php
Find your DocumentRoot directory configuration option that read as follows:

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:FreeBSD内核编译详解

下一篇:Step by Step: Using Samba to join a Windows Domain