1:下载apache 的扩展文件 mod_fcgid.so 文件(http://download.youkuaiyun.com/detail/hm446434459/4146487)
2:解压其中的mod_fcgid.so 到apache的modules目录下
3:修改apache的配置文件 如下:
#加载mod_fcgid.so模块
LoadModule fcgid_module modules/mod_fcgid.so
#fcgid.的配置
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi .php
# Where to look for the php.ini file?
FcgidInitialEnv PHPRC "D:/php"
# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess 1000
# Maximum number of PHP processes
FcgidMaxProcesses 15
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIOTimeout 120
FcgidIdleTimeout 120
#Path to php-cgi
FcgidWrapper "D:/php/php-cgi.exe" .php
# Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php
</IfModule>
4:在apache的配置文件中找到其发布目录配置,添加如下红色部分标注的部分,否则会提示你无权限访问项目目录
<Directory "D:/wamp/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
5:重新启动apache,查看你的phpinfo()中的环境变量中是否加入了fcgid ,注意fcgid 是不支持 PATH_INFO