Wednesday, April 17, 2024

Switch PHP version in Ubuntu OS or Zorin OS

First check where is installed your PHP by the below command:
$ 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

Suomen kieli (Imperfekti)

In Finnish, the imperfekti is the past tense that describes actions that happened in the past, like the English simple past (e.g., "I ...