sudo apt install -y lsb-release gnupg2 ca-certificates apt-transport-https software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.2
# commonly used modules
sudo apt install php8.2-{bcmath,fpm,xml,mysql,zip,intl,ldap,gd,cli,bz2,curl,mbstring,pgsql,opcache,soap,cgi}
# If you use mongodb
sudo apt install php8.2-mongodb
# then you need to edit these 2 files
sudo vi /etc/php/8.2/fpm/php.ini
sudo vi /etc/php/8.2/cli/php.ini
# by adding this line on both files
extension=mongodb.so
[…] Install PHP8.2 […]