前言
之前在CentOS7安装php7.1的时候有遇到PHP源及PHP7.1不支持MySQL扩展问题,上午抽空安装了下终于解决了这两个问题,特此记录备忘。
简单安装(yum方式)
安装软件源
添加epel源[root@opstrip.com opt]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*[root@opstrip.com opt]# rpm -Uvh http://mirrors.rit.edu/fedora/epel//7/x86_64/e/epel-release-7-9.noarch.rpm
添加remi源[root@opstrip.com opt]# rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装并更新软件
安装yum-config-manager实用程序[root@opstrip.com opt]# yum -y install yum-utils
更新系统当前软件版本[root@opstrip.com opt]# yum -y update
更新完成后,就可以安装所需要的PHP版本了。
安装PHP
以上准备工作完成后,就可以安装所需的PHP版本了。
对于PHP5.4[root@opstrip.com opt]# yum -y install php
安装前可尝试yum search php54搜索可安装的软件包。
对于PHP7.0[root@opstrip.com opt]# yum-config-manager --enable remi-php70[root@opstrip.com opt]# yum -y install php php-opcache
安装前可尝试yum search php70搜索可安装的软件包。
对于PHP7.1[root@opstrip.com opt]# yum-config-manager --enable remi-php71[root@opstrip.com opt]# yum -y install php php-opcache
安装前可尝试yum search php71搜索可安装的软件包。
完成后还需要添加PHP常用扩展:[root@opstrip.com opt]# yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
对于Nginx[root@opstrip.com opt]# yum -y install nginx nginx-mod-http-perl nginx-mod-stream nginx-filesystem nginx-mod-mail nginx-mod-http-i