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

Today Upgrade PHP Version, I will let you know example of update php 8.0 to 8.1 ubuntu. if you want to display example of upgrade php 8.0 to 8.1 ubuntu after that you are a exact solution. also you can display how to upgrade php 8.0 to 8.1 ubuntu.

This post goes in detailed on ubuntu update php Version 8.0 to 8.1.

So, step by step started with ubuntu 20 upgrade php Version 8.0 to 8.1.

How to Upgrade PHP Version to Latest Version

How do I upgrade to a newer version of PHP? – just follow bellow Ubuntu 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 display old php version then you can run bellow Ubuntu command & select new php version from there list. therefor run bellow Ubuntu command:

sudo update-alternatives --config php

Good Luck for Upgrade PHP Version!!!
Then it will works !! Is It Okay? – Upgrade PHP Version

Leave a Comment