首先,下載資源:
1 |
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm |
然後,安裝PHP:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#取得所有可安裝的 PHP 版本列表,預設的版本為 PHP 7.2: dnf module list php #Extra Packages for Enterprise Linux Modular 8 - x86_64 39 kB/s | 116 kB 00:02 #Extra Packages for Enterprise Linux 8 - x86_64 1.2 MB/s | 6.2 MB 00:05 #Remi's Modular repository for Enterprise Linux 8 - x86_64 20 kB/s | 540 kB 00:27 #Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 31 kB/s | 1.4 MB 00:45 #CentOS-8 - AppStream #Name Stream Profiles Summary #php 7.2 [d] common [d], devel, minimal PHP scripting language #php 7.3 common, devel, minimal PHP scripting language # #Remi's Modular repository for Enterprise Linux 8 - x86_64 #Name Stream Profiles Summary #php remi-7.2 common [d], devel, minimal PHP scripting language #php remi-7.3 common [d], devel, minimal PHP scripting language #php remi-7.4 common [d], devel, minimal PHP scripting language # #提示:預設[d]、已啟用[e]、已停用[x]、已安裝[i] #依據上述 PHP 列表來啟用要安裝的 PHP 版本,這裡啟用 PHP 7.4: dnf module reset php dnf module enable php:remi-7.4 #安裝: dnf install php |
移除PHP:
1 2 3 4 5 6 7 8 9 |
#dnf sudo dnf list php sudo dnf remove php* 或 #yum sudo yum list installed | grep php sudo yum -y remove php* |