Cover Image for Downgrade php 7.4 to 7.3 Ubuntu
157 views

Downgrade php 7.4 to 7.3 Ubuntu

Downgrading PHP from version 7.4 to 7.3 on Ubuntu can be achieved by following these steps:

  1. Check Current PHP Version:
    Before downgrading, verify your current PHP version by running the following command in the terminal:
php -v
  1. Remove PHP 7.4 Packages:
    To downgrade, you need to remove PHP 7.4 and its associated packages. Use the following commands to remove PHP 7.4 and its modules:
sudo apt-get purge php7.4 php7.4-common php7.4-cli php7.4-fpm
  1. Install PHP 7.3:
    Once you’ve removed PHP 7.4, you can proceed to install PHP 7.3 along with required modules:
sudo apt-get update
sudo apt-get install php7.3 php7.3-common php7.3-cli php7.3-fpm
  1. Choose PHP 7.3 FPM (optional):
    If you are using PHP-FPM, you might need to switch to the PHP 7.3 FPM version:
sudo a2dismod php7.4
sudo a2enmod php7.3
sudo service apache2 restart
  1. Verify PHP 7.3 Version:
    Check if PHP 7.3 is installed and active:
php -v
  1. Update PHP Alternatives (optional):
    In some cases, you may need to update the PHP alternatives so that the system recognizes PHP 7.3 as the default version. Use the following command to set PHP 7.3 as the default version:
sudo update-alternatives --config php

Select the option corresponding to PHP 7.3 from the provided list.

  1. Restart Web Server:
    After the downgrade, restart your web server for the changes to take effect:

For Apache:

sudo service apache2 restart

For Nginx:

sudo service nginx restart

That’s it! PHP 7.4 should now be downgraded to PHP 7.3 on your Ubuntu system. Remember that the availability of PHP versions in the default repositories may vary, and you may need to use third-party repositories to install a specific PHP version. Also, ensure that any applications or scripts you are using are compatible with PHP 7.3 before downgrading.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS