How upgrade PHP 8.1 to PHP 8.2 using ondrej repository on ubuntu 22

In this article we will upgrade from PHP 8.1 to PHP 8.1 using ondrej repository.

This just work with ondrej repository, for more informaction about this repository 



If you have installed PHP 8.1 you will need install additional PHP 8.2 for upgrade after using a command.

Follow this steps.


Install PHP 8.2


sudo apt install php8.2

Install modulos for PHP 8.2. 


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

You can't be enabled bouth php version, you need first disable one and enable other version.

Disable PHP 8.1

sudo a2dismod php8.1

Enable PHP 8.2

sudo a2enmod php8.2


Restart Apache services


sudo service apache2 restart

Switch between PHP versions on ubuntu

You can switch between version, for this example you need has installed one or more version of PHP.


sudo update-alternatives --config php

You will see this screen.



In this case I have installed two versions php8.1 and php8.2, you can select ther version that you wish writing the number and key enter.


Restart Apache services


sudo service apache2 restart



References.

https://www.thedataops.org/how-to-upgrade-php-version-from-8-1-to-8-2-in-ubuntu/


Comments