① 查询是否安装过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
③ 通过云进行php和其他组件的安装
yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel
其他需要的组件在自行安装。
如果想安装php5.5或者5.6版本,将上面的php70w替换为php55w或者php56w就可以了。
php安装参考自:https://www.cnblogs.com/719907411hl/p/6891061.html
和http://blog.csdn.net/zhezhebie/article/details/73325663
亲自进行的代码:
[root@localhost yum.repos.d]# yum list installed |grep php //查询是否安装过php
[root@localhost yum.repos.d]# yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel //安装php
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.shuosc.org
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
......
#中间有两次询问,均写y
Is this ok [y/N]: y
......
Dependency Updated:
pcre.x86_64 0:7.8-7.el6
Complete!
[root@localhost yum.repos.d]# php -v //查看php版本
PHP 7.0.25 (cli) (built: Oct 29 2017 18:22:34) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.25, Copyright (c) 1999-2017, by Zend Technologies