linux php5.3 fastcgi,在RHEL 5.3(Tikanga)上配置Apache + FastCGI(mod_fcgid) + PHP

一,使用软件的详细版本信息如下:

Apache(apache 2.2.15)

Apache FastCGI module(mod_fcgid 2.3.6)

PHP 5.3.3(php-cgi)

相关阅读:

在RHEL 5.3(Tikanga)上配置Apache + FastCGI(mod_fastcgi) + PHP http://www.linuxidc.com/Linux/2012-02/53419.htm

二,详细的配置步骤:

(下面步骤的前提是Apache和PHP(php-cgi)均已经安装)

1,安装mod_fcgid模块

1)下载地址:

http://httpd.apache.org/download.cgi#mod_fcgid

2)从源代码编译安装

[root@www.linuxidc.com mod_fcgid-2.3.6]# whereis apxs

apxs: /opt/httpd/bin/apxs

[root@www.linuxidc.com mod_fcgid-2.3.6]# APXS=/opt/httpd/bin/apxs ./configure.apxs

[root@www.linuxidc.com mod_fcgid-2.3.6]# make

[root@www.linuxidc.com mod_fcgid-2.3.6]# make install

(使用updatedb手动刷新locate数据库,使用locate mod_fcgid.so检查mod_fcgid是否安装成功。)

2,配置Apache

1)查找二进制文件php-cgi的路径(这里我使用从源代码编译安装PHP 5.3.3在/opt目录下,读者可以使用locate php-cgi来查找。)

/opt/bin/php-cgi

2)修改php-cgi使用的php.ini

cgi.fix_pathinfo=1

3)修改Apache的配置文件/opt/httpd/conf/httpd.conf

a, 分别在适当位置添加添加下面两行:

[xhtml]

LoadModule fcgid_module modules/mod_fcgid.so

Include conf.d/php-fcgid.conf

b, 在/opt/httpd/conf.d目录下建立php-fcgid.conf

[xhtml]

# FcgidMaxRequestsPerProcess should be<= PHP_FCGI_MAX_REQUESTS

# The example PHP wrapper script overrides the default PHP setting.

FcgidMaxRequestsPerProcess 10000

# Uncomment the following line if cgi.fix_pathinfo is set to 1 in

# php.ini:

FcgidFixPathinfo 1

# Define a new handler "php-fcgi" for ".php" files, plus the action that must follow

AddHandler php-fcgi .php

Action php-fcgi /cgi-bin/php.fcgi

c, 在/opt/cgi-bin目录下建立php.fcgi(注意修改此文件的权限为755)

[xhtml]

#!/bin/bash

# Path to php.ini

PHPRC=/usr/local/lib

### Set PATH ###

PHP_CGI=/opt/bin/php-cgi

PHP_FCGI_CHILDREN=0

PHP_FCGI_MAX_REQUESTS=1000

### no editing below ###

export PHPRC

export PHP_FCGI_CHILDREN

export PHP_FCGI_MAX_REQUESTS

exec $PHP_CGI

d, 检查配置语法是否正确,然后使用apachectl重启Apache

[root@www.linuxidc.com www]# /opt/httpd/bin/apachectl configtest

Syntax OK

[root@www.linuxidc.com www]# /opt/httpd/bin/apachectl restart

e, 在/opt/httpd/www目录下建立config.inc.php,使用浏览器访问。(若配置正确,那么PHP Variables栏目下的_SERVER["SERVER_SOFTWARE"]一项的值为:Apache/2.2.15 (Unix) mod_fcgid/2.3.6)

[php]

308abf66be38076efe62d57004585b0f.png0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值