Kris01's avatar

Downgrade php version ubuntu 22.04

Hello, I have php v8.1.15 and I am trying to downgrade to php 8.0, and after doing successfully

sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.0

the php version seems to be still 8.1.15

0 likes
3 replies
vincent15000's avatar

You can install multiple PHP versions and then work with the one you need.

Snapey's avatar

What web server? You will need to tell it which php to use

1 like
toledomauricio's avatar
Level 1

You have to switch the version

Remember to check if php8 necessary packages is already installed:

sudo apt-get install php8.0 php8.0-common php8.0-cli php8.0-fpm php8.0-mysql php8.0-curl php8.0-gd php8.0-bcmath php8.0-mbstring php8.0-zip

And to switch the version you can try the following commands:

sudo apt-get remove php8.1
sudo update-alternatives --set php /usr/bin/php8.0
sudo service apache2 restart
1 like

Please or to participate in this conversation.