参考资料:
http://www.blogjava.net/nkjav...
http://www.111cn.net/sys/Cent...
1.检查当前安装的PHP包
yum list installed | grep php
如果有安装的PHP包,先删除他们
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
2.更新yum
Centos 5.X
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
CentOs 6.X
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm 我们系统用这个
CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想删除上面安装的包,重新安装
rpm -qa | grep webstatic
rpm -e 上面搜索到的包即可
3.运行yum install
yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64
注:如果想升级到5.6把上面的55w换成56w就可以了。
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
4.安装PHP FPM
yum install php55w-fpm
yum install php56w-fpm
yum install php70w-fpm
注:如果想升级到5.6把上面的55w换成56w就可以了。
5.安装PHP的MongoDB客户端
MongoDB 依赖php55w-devel.x86_64
yum install php55w-devel.x86_64
代码如下
cd /usr/local/src
wget -c http://pecl.php.net/get/mongo-1.4.4.tgz
tar -xzvf ./mongo-1.4.4.tgz
cd ./mongo-1.4.4
/usr/local/php/bin/phpize # 利用PHP的 phpize 命令来安装扩展
或者:phpize
./configure --with-php-config=/usr/local/php/bin/php-config
或者:./configure
make && make install
完成后,编辑你 php.ini 文件增加一行。
代码如下
cd /etc/php.d/
vi mongo.ini
extension=mongo.so
cd /etc/php-fpm.d
vi www.conf
listen=/tmp/php-cgi.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
user = nginx
group = nginx
vi /etc/php-fpm.conf
daemonize = yes
yum list |grep php55w
yum remove php55w-devel.x86_64
service nginx restart
远程文件对比:
scp root@10.252.213.163:/etc/php-fpm.d/www.conf
scp root@10.252.213.163:/etc/php-fpm.d/www.conf .
diff /etc/php-fpm.d/www.conf www.conf
停止php-fpm:service php-fpm stop
启动php-fpm:service php-fpm start
启动php-fpm:service php-fpm restart
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。