溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

PHP7.4如何在CentOS環(huán)境中安裝

發(fā)布時(shí)間:2020-12-18 15:27:38 來源:億速云 閱讀:205 作者:Leah 欄目:開發(fā)技術(shù)

PHP7.4如何在CentOS環(huán)境中安裝?針對(duì)這個(gè)問題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。

步驟一:添加 EPEL 和 REMI 庫

安裝需要 EPEL 和 REMI 庫。通過以下命令將其添加到系統(tǒng)中

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

步驟二:在 CentOS 8 / RHEL 8 上安裝 PHP 7.4

添加相關(guān)的庫后,啟用 PHP 7.4 的 Remi 模塊并進(jìn)行安裝。

sudo dnf -y install dnf-utils

啟用 PHP 7.4 的模塊流

sudo dnf module install php:remi-7.4

接受安裝提示

Updating Subscription Management repositories.
Last metadata expiration check: 0:00:24 ago on Mon 16 Sep 2019 09:36:21 AM EDT.
Dependencies resolved.
===================================================================================================================================================
 Package           Arch       Version                      Repository                  Size
===================================================================================================================================================
Installing group/module packages:
 php-cli           x86_64      7.4.0~RC1-1.el8.remi               remi-modular                4.6 M
 php-common         x86_64      7.4.0~RC1-1.el8.remi               remi-modular                1.2 M
 php-fpm           x86_64      7.4.0~RC1-1.el8.remi               remi-modular                1.6 M
 php-json          x86_64      7.4.0~RC1-1.el8.remi               remi-modular                 71 k
 php-mbstring        x86_64      7.4.0~RC1-1.el8.remi               remi-modular                524 k
 php-xml           x86_64      7.4.0~RC1-1.el8.remi               remi-modular                211 k
Installing dependencies:
 nginx-filesystem      noarch      1:1.14.1-8.module+el8+2505+fe936cef        rhel-8-for-x86_64-appstream-rpms       24 k
 oniguruma          x86_64      6.8.2-1.el8                    rhel-8-for-x86_64-appstream-rpms      188 k
 httpd-filesystem      noarch      2.4.37-11.module+el8.0.0+2969+90015743      rhel-8-for-x86_64-appstream-rpms       34 k
 libxslt           x86_64      1.1.32-3.el8                   rhel-8-for-x86_64-baseos-rpms        249 k
Installing module profiles:
 php/common                                                                    
Enabling module streams:
 httpd                     2.4                                                
 nginx                     1.14                                                
 php                      remi-7.4                                              

Transaction Summary
===================================================================================================================================================
Install 10 Packages

Total download size: 8.6 M
Installed size: 43 M
Is this ok [y/N]: y

使用如下命令安裝額外的包

sudo dnf update
sudo yum install php-xxx

當(dāng)前的 PHP 版本應(yīng)該為 7.4

$ php -v
PHP 7.4.0 (cli) (built: Nov 26 2019 20:13:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

查看已啟用的模塊:

$ php --modules

你已成功在 CentOS 8 / RHEL 8 上安裝 PHP 7.4。

關(guān)于PHP7.4如何在CentOS環(huán)境中安裝問題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI