$ which php
See PHP version by below command:
$ php -v
As I've installed PHP version 7.4 and 8.1. I will try to install another PHP version
and that is 8.2, then we'll switch from 8.1 to 8.2.
Add a software package to install new version or older version of PHP by below command:
$ sudo apt install software-properties-common
Now run the below command to add that repository:
$ sudo add-apt-repository ppa:ondrej/php
Now install PHP 8.2 by below command:
$ sudo apt install php8.2
Now you need to switch PHP version, first run by below command to see PHP list:
$ sudo update-alternatives --config php
And then finally you can switch PHP version by entering selection number and hit enter.
.:Happy Coding:.
No comments:
Post a Comment