当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > Ubuntu 8.04中使用fast-cgi搭建Apache2+PHP5环境

Unix/Linux
RHEL 5服务器系统下故障处理方法
Linux系统下图形界面更改IP地址
Linux操作系统下禁止单用户模式登录的操作方法
Linux中QQ软件的安装和配置
linux 操作系统 uniq命令的说明和使用
Linux 上如何使用QQ和MSN工具
The file /boot/grub/stage1 not read cor 解决办法
如何修改apache 2最大连接数
4G内存时linux的mtrr表不正确的解决
制作Linux的U盘(usb)启动盘
Linux Telnet登录慢问题解决
LINUX操作系统死机解决办法
linux的3种引导方法
vi编辑器使用技巧
Linux使用的一些基本问题
Linux系统下使用wine运行迅雷5的方法
startx启动图形界面失败的几个解决方法
Red Hat Enterprise Linux AS4( 企业版4.0下载)
Raid的学习和基础知识
Linux 下如何配置 PHP 支援 GD

Unix/Linux 中的 Ubuntu 8.04中使用fast-cgi搭建Apache2+PHP5环境


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-15   浏览: 94 ::
收藏到网摘: n/a

在Ubuntu中搭建一般的LAMP环境实在是太简单的一件事, 只需要

$sudo apt-get install apache2 php5 mysql-server libapache2-mod-php5

就好了(差不多, 如果没记错的话).

然而, 这样搭建出来的LAMP环境, PHP是通过Apache2的mod执行的, 这也就是软件包libapache2-mod-php5的作用. 通过mod执行的PHP有速度快, 方便等诸多优势. 不过现在我就是想要它通过Fastcgi执行. 别问为什麽.

找了好多资料, 奇怪怎麽就没人能说清楚, 真是..... 只好自己总结了

----------------------cut here----------

首先, 删除libapache2-mod-php5, 因为没用了.$sudo a2dismod php5
$sudo apt-get remove libapache2-mod-php5

安装cgi版的php(自己会支持fcgi的)和apache2的action模块
$sudo apt-get install php5-cgi
$sudo a2enmod actions

新建目录, 把安装的php5-cgi扔过去

$sudo mkdir /usr/local/php5-fcgi
$sudo mkdir /usr/local/php5-fcgi/bin
$sudo cp /usr/bin/php5-cgi /usr/local/php5-fcgi/bin/

下面关键了, 总是出错的就是这了

在你的虚拟主机配置(sites-enabled那里)文件,

之内, 其他标签之外添加这些内容:

ScriptAlias /fcgi-bin/ "/usr/local/php5-fcgi/bin/"
Action php-fastcgi /fcgi-bin/php5-cgi
AddHandler php-fastcgi .php
AddType application/x-httpd-php .php

Options FollowSymLinks ExecCGI


然后重启apache2, 完事.