1 頁 (共 1 頁)

[轉貼] Setting up PHP as Fast CGI (FCGI) under Apache

發表於 : 2012-02-18, 15:26
心靈捕手
1) Download the Apache mod_fcgi module: http://fastcgi.coremail.cn/

2) Configuration in your Apache httpd.conf:
a) LoadModule fcgid_module modules/mod_fcgid.so

b.1) <Directory "C:/Apache2/htdocs/php/">
SetHandler fcgid-script
Options execCGI
AllowOverride None
Order allow,deny
Allow from all
FCGIWrapper "c:/php/php-cgi.exe" .php
</Directory>

b.2) This works too (it's actually the method I'm using):

AddHandler fcgid-script .php

<Directory "C:/Apache2/htdocs/php/">
FCGIWrapper "c:/php/php-cgi.exe" .php
Options ExecCGI
allow from all
</Directory>

So using method b.2:
Just add to your httpd.conf:
AddHandler fcgid-script .php

Then in the folders running your PHP scripts:
FCGIWrapper "c:/php/php-cgi.exe" .php
Options ExecCGI

3) To overwrite any of the default FCGI directives in your httpd.conf see:
http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html (now part of Apache.org ... was htttp://fastcgi.coremail.cn/doc.htm)

One particular setting is recommend:
MaxRequestsPerProcess 500

4) This is in the doc but if you missed it:

Note: If you get:

Can't create TCP/IP socket (10106) error while running PHP script(on Win32 only), you will have to set these (Please modify the values if necessary):
DefaultInitEnv PHPRC "c:/php/"
DefaultInitEnv PATH "c:/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
DefaultInitEnv SystemRoot "C:/Windows"
DefaultInitEnv SystemDrive "C:"
DefaultInitEnv TEMP "C:/WINDOWS/TEMP"
DefaultInitEnv TMP "C:/WINDOWS/TEMP"
DefaultInitEnv windir "C:/WINDOWS"

(Thank Steffen of apachelounge.com for this note)
Note: SiteBuddy.com is now under FCGI also using eAccelerator 0.9.5.

--
資料來源:
http://www.sitebuddy.com/php/php_apache ... gi_install

--
參考連結: