更新源:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmphp
安裝服務:
yum -y install httpdhtml
CentOS7啓動服務:
systemctl start httpd.servicemysql
CentOS7設置開機啓動服務:
systemctl enable httpd.servicenginx
安裝 EPEL 軟件包:web
$ sudo yum install epel-release
sql
安裝 remi 源:shell
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
json
安裝 yum 擴展包:centos
$ sudo yum install yum-utils
bash
啓用 remi 倉庫:
$ sudo yum-config-manager --enable remi-php72 $ sudo yum update
$ sudo yum install php72
輸入 php72 -v
查看安裝結果
$ sudo 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
安裝擴展:
yum install mod_php72w
安裝編譯:
yum install php72w-devel
yum install centos-release-scl
sudo yum install devtoolset-7
scl enable devtoolset-7 bash
安裝pecl:
yum install php-devel php-pear
$ sudo systemctl enable php72-php-fpm.service
# 開啓服務
$ sudo systemctl start php72-php-fpm.service
# 中止服務
$ sudo systemctl stop php72-php-fpm.service
# 查看狀態
$ sudo systemctl status php72-php-fpm.service
# nginx 配置文件 /etc/nginx/nginx.conf # nginx 默認項目路徑 /usr/share/nginx/html