Centos 5.7下安装PHP+Nginx+FastCGI

drise 2012-01-13

1.centos版本

lsb_release -a

LSBVersion::core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch

DistributorID:CentOS

Description:CentOSrelease5.7(Final)

Release:5.7

Codename:Final

2.设置EPEL,EPEL是一个红帽子下一个提供大量第三方包的Repository,不然下文的spawn-fcgiyum无法找到资源

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

3.Installngnix

yum install nginx
#为nginx创建用户组
groupadd nginx
useradd -d /home/nginx -g nginx nginx

4.ConfigurePHPAsFastCGI

# yum install php-pear-Net-Socket php-pear php-common php-gd php-devel php php-mbstring php-pear-Mail php-cli php-imap php-snmp php-pdo php-xml php-pear-Auth-SASL php-ldap php-pear-Net-SMTP php-mysql

# yum install spawn-fcgi

# wget http://bash.cyberciti.biz/dl/419.sh.zip
# unzip 419.sh.zip
# mv 419.sh /etc/init.d/php_cgi
# chmod +x /etc/init.d/php_cgi

# /etc/init.d/php_cgi start
# netstat -tulpn | grep :9000

5.安装json模块

php安装json模块 RedHat/Centos
yum install php-devel
yum install php-pear
yum install gcc
pecl自动编译安装:
pear install pecl/json
cd /etc/php.d
echo "extension=json.so" > json.ini
service httpd restart
查看是否安装成功
php in.php |grep json
php -m|grep json

相关推荐