fastcgi+apache+php的配置

本文详细介绍了如何在Apache1.3.x上安装和配置FastCGI、fcgi开发包、mod_fastcgi模块以及PHP5.x,以FastCGI模式运行PHP程序。通过加载FastCgiServer和配置VirtualHost,实现Apache与PHP的高效协同。
1.apache安装
这里安装apache1.3.x,因为在我的虚拟机上在apache2.x下怎么也安装不上mod_fastcgi
./configure /配置参数/
.make
.make install
 
2.fcgi安装
版本fcgi-2.4.0 ( http://www.fastcgi.com)可以下载
fcgi是fastcgi的开发包,需要在mod_fastcgi之前安装
这个安装很简单,而且很顺利
 
3.mod_fastcgi安装
版本mod_fastcgi-2.4.2
apache的fastcgi模块.
这里有两种安装方式(共享模块/静态模块),解压文件夹后,查看(INSTALL.txt,apache 2.x看INSTALL.AP2)里面有详细的安装说明.
我的安装如下:(共享模块方式)
cd <mod_fastcgi_dir>
<mod_fastcgi_dir>$ apxs -o mod_fastcgi.so -c *.c
<mod_fastcgi_dir>$ apxs -i -a -n fastcgi mod_fastcgi.so
 
 
4. php的编译方式
版本php5.x
./configure --enable-fastcgi --enable-force-cgi-redirect --disable-cli --with-apxs=/usr/local/apche/apxs
make
make install
安装成功后,执行
php -v 输出
PHP 5.1.4 (cgi-fcgi).
这里输出带了cgi-fcgi
 
如果编译时不加--disable-cli则输出
PHP 5.1.4 (cli).
 
5.apache配置
以上安装完后,需要配置apache来以fastcgi模式运行php程序。
假定php和fastcgi都是以apache的共享模块来安装的。
//加载模块
LoadModule php5_module        libexec/libphp5.so
LoadModule fastcgi_module     libexec/mod_fastcgi.so
 
//ln -s /var/www/php/cgi-bin/php5.fcgi /usr/local/php5-fcgi/bin/php
//以静态方式执行fastcgi 启动了10进程
FastCgiServer /var/www/php/cgi-bin/php5.fcgi -processes 10 -idle-timeout 150 -pass-header HTTP_AUTHORIZATION
<VirtualHost *:80>
 DocumentRoot /var/www/php
 ServerName www.php.com
 
 ScriptAlias /fcgi-bin/ /var/www/php/cgi-bin/
 Options +ExecCGI
 
 AddHandler fastcgi-script .fcgi
 AddType application/x-httpd-php .php
 Action application/x-httpd-php /fcgi-bin/php5.fcgi
 <Directory /var/www/php>
 Options Indexes ExecCGI
 Order allow,deny
 allow from all
 </Directory>
</VirtualHost>
 
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值