yum list installed | grep php
先删除已有的php版本 ,执行下面的命令删除php
yum remove php-common
然后像安装那样问你是否继续的,输入yes即可
添加 yum 源
CentOS 6.x 的源
# rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
CentOS 7.x 的源
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
安装 PHP
# yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common
注:安装5.6版本为remi-php56,安装5.5版本为remi-php55
查看 PHP 版本
# php -v PHP 5.6.18 (cli) (built: Feb 3 2016 10:25:33) Copyright (c) 1997-2016 The PHP Group
在Linux中将php-fpm配置成服务的方法
1.配置php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
php-fpm.pid 目录必须指向:/usr/local/php/var/run/php-fpm.pid
2.拷贝php-fpm脚本至/etc/init.d目录
cp /home/soft/php-5.3.15/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
3.设置权限并启动php-fpm:
chmod 755 /etc/init.d/php-fpm
/etc/init.d/php-fpm start
chkconfig –add php-fpm
最后,给出php-fpm以服务的方式启动、停止和重启:
service php-fpm start
service php-fpm stop
service php-fpm reload
(adsbygoogle = window.adsbygoogle || []).push({});