方法一:
yum -y remove php*
// 更改yum源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
// yum 安裝
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
// 開機自啓
systemctl enable php-fpm.service
// 啓動 php-fpm
systemctl start php-fpm.service
netstat -lntp
方法二:
安裝源
安裝 EPEL 軟件包:
yum install epel-release
安裝 remi 源:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安裝 yum 擴展包:
yum install yum-utils
啓用 remi 倉庫:
yum-config-manager --enable remi-php72 $ sudo yum update
安裝 PHP7,2
yum install php72
輸入 php72 -v 查看安裝結果
安裝 php-fpm 和一些其他模塊:
yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache
php-fpm 服務
設置開機自啓
systemctl enable php72-php-fpm.service
常用 php-fpm 命令
開啓服務 systemctl start php72-php-fpm.service
停止服務 systemctl stop php72-php-fpm.service
查看狀態 systemctl status php72-php-fpm.service