首先更新系统:
sudo apt update && sudo apt upgrade -y
Ubuntu 24执行以下命令即可安装php8.3:
sudo apt install php -y
安装完成后,检查php的版本:
php --version
使用sudo apt install php8.3-PACKAGE_NAME
命令安装php常用扩展,把PACKAGE_NAME
替换为具体的扩展名:
sudo apt install -y php8.3-cli php8.3-common php8.3-fpm php8.3-mysql php8.3-zip php8.3-gd php8.3-mbstring php8.3-curl php8.3-xml php8.3-bcmath php8.3-sqlite3 php8.3-intl php8.3-bz2 php8.3-imagick php8.3-redis
查看已经安装了哪些php扩展:
php -m
参考