How to Upgrade PHP Version from 8.1 to 8.2 in Ubuntu?

By Hardik Savani May 14, 2024 Category : PHP Ubuntu

Hi Dev,

Are you looking for an example of update php 8.1 to 8.2 ubuntu. In this article, we will implement a upgrade php 8.1 to 8.2 ubuntu. if you want to see an example of how to upgrade php 8.1 to 8.2 ubuntu then you are in the right place. This article goes in detailed on ubuntu update php 8.1 to 8.2.

just follow bellow command to update php 8.1 to php 8.2 in ubuntu os.

Add PPA for PHP 8.2

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

Install PHP 8.2

sudo apt install php8.2

Install PHP 8.2 Packages

sudo apt install php8.2-common php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-curl php8.2-gd php8.2-imagick php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-opcache php8.2-soap php8.2-zip php8.2-intl -y

PHP 8 Enable

sudo a2dismod php8.1

sudo a2enmod php8.2

sudo service apache2 restart

now you can check php version:

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

i hope it can help you....

Tags :
Shares