操做系统:腾讯云CentOS Linux release 7.6.1810 (Core)php
cat /etc/centos-release //查看系统版本
1、先检查之前有没有安装的版本,若是有删除以前的 php 版本:mysql
yum remove php* php-common
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
2、rpm 安装 Php7 相应的 yum源web
CentOS/RHEL 7.x:sql
1 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 2 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
能够用yum search php7查看下安装源的版本centos
yum search php7
看来最新的是php72w,下来就开始安装吧php7
3、安装PHPspa
yum install php72w //根据需求选择模块
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
查看安装模块和版本:操作系统
yum list installed | grep php //查看安装木块
php -v //查看安装版本
4、经常使用systemctl指令:rest
systemctl enable *.service #开机运行服务 systemctl disable *.service #取消开机运行 systemctl start *.service #启动服务 systemctl stop *.service #中止服务 systemctl restart *.service #重启服务 systemctl reload *.service #从新加载服务配置文件 systemctl status *.service #查询服务运行状态 systemctl --failed #显示启动失败的服务