PHP 8.0 reached end of life on 26 Nov 2023 and is no longer being updated. It's strongly recommended to upgrade to the latest version as soon as possible. You can read the official PHP migration guide here.
Add the PHP repository:
sudo add-apt-repository ppa:ondrej/php
Update the package list:
sudo apt update
Install PHP 8.0:
sudo apt install php8.0
Install common PHP extensions:
sudo apt install php8.0-common php8.0-mysql php8.0-xml php8.0-curl php8.0-gd php8.0-imagick php8.0-cli php8.0-dev php8.0-imap php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip php8.0-intl
Check the PHP version:
php -v
You should see output indicating PHP 8.0.x is installed.
Verify PHP configuration:
php -i
This will display detailed PHP configuration information.
Check installed PHP modules:
php -m
This will list all installed PHP modules.