PHP 8.2 reached end of active support on 31 Dec 2024. As of today, PHP 8.2 is only receiving security related updates through 31 Dec 2026, at which point it will be considered end-of-life and receive no further updates. It's strongly recommended to upgrade to the latest version of PHP before then.
Update the package list:
sudo apt update
Add the PHP repository:
sudo add-apt-repository ppa:ondrej/php
Install PHP 8.2:
sudo apt install php8.2
Install common PHP extensions:
sudo apt install php8.2-common php8.2-mysql php8.2-xml php8.2-curl php8.2-gd php8.2-mbstring php8.2-zip
Check the PHP version:
php -v
This should display PHP 8.2.x information.
Verify PHP configuration:
php -i
This will show detailed PHP configuration information.
Check installed modules:
php -m
This will list all installed PHP modules.