yum安装指定版本php的方法:首先执行命令“yum -y install epel-release”;然后安装“yum-config-manager”实用程序;接着选择对应的PHP版本进行安装;最后执行install命令即可。
推荐:《PHP视频教程》
1、安装源
安装epel-release:yum -y install epel-release
添加remi源:rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装yum-config-manager实用程序:yum -y install yum-utils
2、安装PHP
选择对应的版本进行安装
安装PHP5.4:yum install -y php
安装PHP7.0:yum-config-manager --enable remi-php70
yum -y install php php-opcache
安装PHP7.1:yum-config-manager --enable remi-php71
yum -y install php php-opcache
安装前可使用yum search php71搜索可安装的软件包。
完成后还需要添加PHP常用扩展:yum -y install php-mysql php-gd php-ldap ph