How to Upgrade PHP Version from 8.1 to 8.2 in Ubuntu

Are you seeking for a PHP 8.1 to 8.2 Ubuntu update example. In this article, we’ll show you how to upgrade Ubuntu from PHP 8.1 to PHP 8.2. You’ve come to the right place if you want to see an illustration of how to upgrade PHP from version 8.1 to 8.2 on Ubuntu. The specifics of the Ubuntu update to PHP 8.2 are covered in this article.

To update PHP 8.1 in the Ubuntu OS to PHP 8.2, simply run the command below.

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 still shows old php version then you can run the below command and choose the new PHP version from there list. so run the below command:

sudo update-alternatives --config php

I hope it can help you!!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x