注意:一定要先安装Mysql后再安装PHP,否则安装其他版本的mysql的时候mysql-libs会报错,当然,卸载了mysql-libs也就可以继续安装了。
1.检查当前安装的PHP包
yum list installed | grep php
如果有安装的PHP包,先删除他们
yum remove php*
2、安装rpm源包
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、安装php
php5.5:
yum install php55w php55w-cli php55w-common php55w-gd php55w-ldap php55w-mbstring php55w-mysqlphp55w-pdo
php5.6:
yum install php56w php56w-cli php56w-common php56w-gd php56w-ldap php56w-mbstring php56w-mysql php56w-pdo
PHP7.0:
yum install php70w php70w-cli php70w-common php70w-gd php70w-ldap php70w-mbstring php70w-mysql php70w-pdo
4.安装PHP FPM
yum install php55w-fpm
yum install php56w-fpm
yum install php70w-fpm