windows 下 apache 开启fcgid模式(fastcgi)

本文指导如何在Windows上将Apache配置为使用FCGI模式处理PHP。首先,需要下载并安装mod_fcgid模块到Apache的modules目录,然后修改Apache配置文件加载该模块,并设置相关参数。接着,确保配置发布目录时包含ExecCGI选项,以允许执行CGI。最后,重新启动Apache,通过phpinfo()检查FCGI是否成功启用。请注意,FCGI不支持PATH_INFO。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值