How to Downgrade PHP 8.0 to 7.4 Ubuntu?

How To Downgrade Php 8.0 To 7.4 Ubuntu?
Table of Contents


If you need to downgrade PHP 8.0 to 7.4 in ubuntu then I will let you know the commands to downgrade PHP 8.0 to 7.4 in ubuntu.

you can also downgrade PHP 7.4 to 7.3, downgrade PHP 7.3 to 7.2, downgrade PHP 7.2 to 7.1 and downgrade 7.1 to 7.0 PHP version in ubuntu.

a few days ago I updated my ubuntu 20.04 and the PHP version was updated 7.4 to 8.0. but, when I ran my PHP WordPress project on EasyEngine then I got some errors with the EasyEngine site-type-wp package. so I thought for now I need to rollback PHP version 7.4 now.


You also want to rollback to install 7.4 then you can run these commands:

// Enable PPA for PHP 7.4 in your system and install it.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

sudo apt-get install php7.4
sudo apt-get install php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-mysql php7.4-mbstring  php7.4-zip php7.4-fpm php7.4-intl php7.4-simplexml

// a2dismod disables the php8.0 module by removing those symlinks.
sudo a2dismod php8.0

// a2enmod enables php7.4 module within the apache2 configuration.
sudo a2enmod php7.4

// Restart apache2 service.
sudo service apache2 restart  

// Set alternative name path.
sudo update-alternatives --set php /usr/bin/php7.4
sudo update-alternatives --set phar /usr/bin/phar7.4
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4
sudo update-alternatives --set phpize /usr/bin/phpize7.4
sudo update-alternatives --set php-config /usr/bin/php-config7.4

I hope it will be helpful for you. 🙂


  1. Thank you, this helped me because on 8.0 I was getting parse errors showing entire source code. And downgrading back to 7.4 using 20.04 lts helped! Thanks again~

Leave a comment

Your email address will not be published. Required fields are marked *