顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== Debian 10 升級 php 至 7.4 ====== * 升級環境 : Debian GNU/Linux 10 \n \l * 原本安裝 php 7.3 ===== 升級程序 ===== - 進行已安裝套件更新 <cli> apt update apt upgrade -y </cli> - 下載 PHP 7.4 的 Sury PPA 與設定<cli> apt -y install lsb-release apt-transport-https ca-certificates wget wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list </cli> - Apache 環境安裝 PHP 7.4<cli> apt update apt install php7.4 php -v a2dismod php7.3 a2enmod php7.4 </cli> - 可以至 /etc/apache2/mods-enabled 看是否已經切換為 php7.4 - 重新啟動 apache2 <cli> service apache2 restart </cli> <note> * **php相關套件的安裝** * 原有 php 7.3 所安裝的套件也需要配合安裝 php 7.4 版本相對套件 * 查詢已安裝的套件清單 <cli> apt list --installed | grep php </cli><file> php7.3-cli/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-common/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-curl/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-gd/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-json/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-mbstring/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-mysql/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-opcache/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-readline/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-xml/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.3-zip/oldoldstable,now 7.3.31-1~deb10u4 amd64 [installed,upgradable to: 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d] php7.4-cli/buster,now 1:7.4.33-6+0~20230609.83+debian10~1.gbp32abef amd64 [installed,automatic] php7.4-common/buster,now 1:7.4.33-6+0~20230609.83+debian10~1.gbp32abef amd64 [installed,automatic] php7.4-json/buster,now 1:7.4.33-6+0~20230609.83+debian10~1.gbp32abef amd64 [installed,automatic] php7.4-opcache/buster,now 1:7.4.33-6+0~20230609.83+debian10~1.gbp32abef amd64 [installed,automatic] php7.4-readline/buster,now 1:7.4.33-6+0~20230609.83+debian10~1.gbp32abef amd64 [installed,automatic] php7.4/buster,now 1:7.4.33-6+0~20230609.83+debian10~1.gbp32abef all [installed] </file> * 發現還有 curl, gd, mbstring mysql xml zip 套件需要安裝 <cli> apt install php7.4-curl php7.4-gd php7.4-mbstring php7.4-mysql php7.4-xml php7.4-zip </cli> * 安裝後重啟 apache2 <cli> service apache2 restart </cli> </note> ===== 參考網址 ===== * https://www.cloudbooklet.com/install-php-7-4-on-debian-10/ {{tag>php}} tech/debian_php_upgrade.txt 上一次變更: 2023/06/26 16:47由 jonathan