首先卸载旧版本PHP:
yum remove php*
接着安装epel:
yum -y install epel-release
更新软件源(centos自带的软件源没有PHP7):
根据系统版本安装!!
//Centos 5.X:
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpmCentOs 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
执行清理,否则会出现skip-broken:
yum clean
安装php7.1和拓展:
yum install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath
设置开机自启:
chkconfig --levels 235 php-fpm on
开启PHP-FPM服务:
service php-fpm start
安装完毕。