Effortlessly Upgrade PHP to Version 8.2 on Ubuntu (Step-by-Step Guide)

Effortlessly Upgrade PHP to Version 8.2 on Ubuntu

Is your Ubuntu-powered website running on an older PHP version? Upgrading to PHP 8.2 brings a host of benefits, including cutting-edge features and improved security. This guide simplifies the process, walking you through the steps regardless of your cloud platform (AWS, Azure, GCP, etc.).

Upgrade Your PHP Version in a Breeze:

Ready to harness the power of PHP 8.2? Here’s a straightforward approach you can follow using your terminal or SSH client:

1. Add PPA for PHP 8.2

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

2. Install PHP 8.2

sudo apt install php8.2

3. Install PHP 8 Packages

sudo apt install php8.2 php-common php8.2-apcu php8.2-cli php8.2-common php8.2-curl php8.2-fpm php8.2-mysql php8.2-opcache php8.2-readline

4. Enable PHP 8.2

sudo a2dismod php8.0
sudo a2enmod php8.2

sudo service apache2 restart

Now to check php version. Use Following Command.

php -v

If it’s still show old php version then you can run bellow command and choose new php version from there list. so run bellow command:

sudo update-alternatives --config php

Then it will works.

× Chat with me