CentOS 將VestaCP的PHP 5.6升級到PHP7.4

VestaCP安裝完成後預設的php版本是5.6,但是php5.6已經在2019/12.31停止支援,所以強烈建議一定要更新到最新版本,一來是php效能提升,二來是安全性提升減少被攻擊的漏洞。
PHP版本支援 https://www.php.net/supported-versions.php

安裝Remi Repository 和 EPEL Repository

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm

接下來準備安裝,如果要指定其他版本則將remi-php72這個指令改成您要的版本。

yum install yum-utils
yum-config-manager --enable remi-php72

進行php版本更新

yum update -y

檢查php版本是否已經更新了

php -v

如果php升級過程失敗(沒有更新/沒有發生)或者您之前從5.6升級到7相關版本,那您需要執行以下指令禁止,然後重新安裝指定版本。

yum-config-manager --disable remi-php56

關於作者 碼農Roy

曾經北漂的工程師,現在專注於.Net Core、WordPress開發


發佈留言