Ubuntu

How To Upgrade PHP Version From 8.0 To 8.1 In Ubuntu?

Today, I will let you know example of update php 8.0 to 8.1 ubuntu. if you want to see example of upgrade php 8.0 to 8.1 ubuntu then you are a right place. you can see how to upgrade php 8.0 to 8.1 ubuntu. This article goes in detailed on ubuntu update php 8.0 to 8.1. Let's get started with ubuntu 20 upgrade php 8.0 to 8.1.

  • 4.5/5.0
  • Last updated 08 September, 2022
  • By Admin

just follow bellow command to update php 8.0 to php 8.1 in ubuntu os

Add PPA for PHP 8.1
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Install PHP 8.1
sudo apt install php8.1
Install PHP 8.1 Packages
sudo apt install php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-dev php8.1-imap php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-intl -y
PHP 8 Enable
sudo a2dismod php8.0
sudo a2enmod php8.1
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....