Centos下yum怎麼安裝php7?

一个新手
發布: 2023-03-16 13:36:01
原創
8328 人瀏覽過

Centos下yum怎麼安裝php7?

Centos下yum要怎麼安裝php7?

1、安裝來源

安裝php7,是需要設定額外的yum來源地址的,否則會報錯不能找到相關軟體包。

Centos下yum怎麼安裝php7?

php高版本的yum來源位址,有兩個部分,其中一部分是epel- release,另外一部分來自webtatic。如果跳過epel-release的話,安裝webtatic的時候,會有錯誤爆出。

Centos下yum怎麼安裝php7?

所以,這裡需要的指令是:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
登入後複製

#當然,您也可以選擇下面的這個指令,也是一樣的效果。

yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
登入後複製

2、清除歷史版本

為了防止centos上面發生php衝突,所以,這個指令還是先執行一下更好些。

yum -y remove php*
登入後複製

3、安裝php7和各種拓展

#事實上,這裡面的對應擴充庫很多,這裡大家一定要注意cli fpm這兩個包,而其它的相關包就看您需要了。

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel
登入後複製

還有比較豪華的版本:

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
登入後複製

4、安裝完成以後,啟動服務

systemctl enable php-fpm.service
systemctl start php-fpm.service
登入後複製

5、安裝成功

 更多相關知識,請造訪 PHP中文網! !

以上是Centos下yum怎麼安裝php7?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!