操做系統:騰訊雲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 #顯示啓動失敗的服務