最後更新: 2023-01-06
前言
Ubuntu 20.04 跟機來的 PHP 版本係 7.4,
如果想用新版本就要透過 PPA repository 去安裝
安裝
apt-get install software-properties-common -y
add-apt-repository ppa:ondrej/php
# 找想要安裝的版本
apt-cache search php8.0
# 安裝
apt install php8.0-fpm php8.0-cli php8.0-common php8.0-opcache \ php8.0-mysql php8.0-mcrypt \ php8.0-mbstring php8.0-gd \ php8.0-soap php8.0-xml php8.0-yaml \ php8.0-intl php8.0-pspell php8.0-tidy \ php8.0-zip php8.0-bz2 php8.0-lz4 \ php8.0-apcu php8.0-redis php8.0-bcmath php8.0-uuid php8.0-curl
# Config
/etc/php/8.0/fpm/php-fpm.conf