一点php博客分享关于apache如何通过fastcgi方式加载PHP,本文采用的操作系统是linux。首先查看apache中是否已经编译存在mod_fcgid.so模块,如果存在则在httpd.conf中进行引入
1 |
LoadModule fcgid_module modules/mod_fcgid.so |
如果不存在,则在apache官网进行下载并且编译安装后引入
模块下载地址:
1 2 3 4 5 6 |
http://labs.renren.com/apache-mirror//httpd/mod_fcgid/mod_fcgid-2.3.6.tar.gz tar zxvf mod_fcgid-2.3.6.tar.gz cd mod_fcgid-2.3.6 APXS=/soft/apache/bin/apxs ./configure.apxs #是apache的安装地址 make&&make install |
最后在apache的配置文件中添加以下配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<IfModule fcgid_module> FcgidIOTimeout 384 FcgidConnectTimeout 360 FcgidOutputBufferSize 128 FcgidMaxRequestsPerProcess 1000 FcgidMinProcessesPerClass 0 FcgidMaxProcesses 16 FcgidMaxRequestLen 524288000 FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000 FcgidInitialEnv PHPRC /usr/local/php/bin/ AddHandler fcgid-script .php FcgidWrapper /usr/local/php/bin/php-cgi .php ProcessLifeTime 360 </IfModule> |
重启apache /etc/init.d/httpd restart
完事。
一点PHP,每天一点技术分享。