Cambiar versión PHP UBUNTU 20

 # Verify PHP

php --version

# Output

PHP 8.0.13 (cli) (built: Nov 22 2021 09:50:43) ( NTS )

Copyright (c) The PHP Group

Zend Engine v4.0.13, Copyright (c) Zend Technologies

    with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies



# Switch PHP
sudo update-alternatives --config php

# Output
There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.0   80        auto mode
  1            /usr/bin/php7.0   70        manual mode
* 2            /usr/bin/php8.0   80        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/php7.0 to provide /usr/bin/php (php) in manual mode

# Switch
sudo update-alternatives --config phar

# Output
There are 2 choices for the alternative phar (providing /usr/bin/phar).

  Selection    Path              Priority   Status
------------------------------------------------------------
  0            /usr/bin/phar8.0   80        auto mode
  1            /usr/bin/phar7.0   70        manual mode
* 2            /usr/bin/phar8.0   80        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/phar7.0 to provide /usr/bin/phar (phar) in manual mode

# Switch
sudo update-alternatives --config phar.phar

# Output
There are 2 choices for the alternative phar.phar (providing /usr/bin/phar.phar).

  Selection    Path                   Priority   Status
------------------------------------------------------------
  0            /usr/bin/phar.phar8.0   80        auto mode
  1            /usr/bin/phar.phar7.0   70        manual mode
* 2            /usr/bin/phar.phar8.0   80        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/phar.phar7.0 to provide /usr/bin/phar.phar (phar.phar) in manual mode