Switch PHP versions on Ubuntu

By admin, 16 December, 2022

Command Line PHP

sudo update-alternatives --config php

Select php8.0 from the list with the available options:

There are 2 choices for the alternative php (providing /usr/bin/php).
Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.1   81        auto mode
* 1            /usr/bin/php8.0   80        manual mode
  2            /usr/bin/php8.1   81        manual mode
Press <enter> to keep the current choice[*], or type selection number: