1. 程式人生 > >centos 7 使用yum安裝php7

centos 7 使用yum安裝php7

安裝php7相應的yum源

CentOS/RHEL 7.x:

# 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 CentOS/RHEL 6.x: # rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

如果使用上面方式發現無法安裝相應的yum源。則修改yum的源為阿里雲的源。如下 :

下載相應的源如下:

我這裡系統是Centos7所以下載相應的Centos7的源。

centOS7的源路徑為:# /etc/yum.repos.d/

路徑下有以上檔案,刪除以上所有檔案 ,將下載的阿里雲的檔案拷貝到此目錄下(/etc/yum.repos.d/).

然後執行如下命令:

# yum clean all;

#yum makecache;

執行完成 後繼續執行:

centos7執行: # 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 centos6執行: # rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

這裡發現正常執行,正常下載相應的php源。

通過命令:

yum search php7

檢視php7的版本資訊。

安裝php7

# yum install mod_php71w php71w-opcache php71w-fpm

安裝php7擴充套件:

# yum install php71w-gd php71w-mbstring php71w-pecl-redis php71w-pgsql

到此php7安裝成功。