Apache模塊配置:FCGID
mod_fcgid是HTTPD的官方FastCGI管理器,能夠管理PHP等FastCGI程序的生命周期,復(fù)用服務(wù)進(jìn)程以提升性能。使用mod_fcgid時(shí)需首先加載該庫:
LoadModule fcgid_module mod_fcgid.so
然后對其進(jìn)行配置:
<IfModule fcgid_module>
FcgidInitialEnv PHPRC "D:/PHP/php74" # 確定php.ini的位置
FcgidMaxRequestsPerProcess 1024 # 每個(gè)FCGI進(jìn)程請求數(shù)
FcgidMaxProcesses 4
# 最大FCGI進(jìn)程數(shù),共計(jì)接受4096個(gè)請求,超出可能會(huì)報(bào)503錯(cuò)誤
FcgidIOTimeout 180
FcgidIdleTimeout 240
AddType application/x-httpd-php .php
<Files ~ "\.php$">
AddHandler fcgid-script .php
FcgidWrapper "D:/PHP/php74/php-cgi.exe" .php
</Files>
</IfModule>
最后為DocumentRoot添加讀取權(quán)限:
DocumentRoot "${DOCROOT}"
<Directory "${DOCROOT}">
AllowOverride All
Options +Indexes +ExecCGI
Require all granted
</Directory>
即可使用FastCGI執(zhí)行PHP程序。

標(biāo)簽: