How to change default php-cli version

Post Reply
gatto
Posts: 5
Joined: Fri May 07, 2021 10:56 pm
How to change default php-cli version

Post by gatto »

Hello Dpeca, great work.
i follow this instructions and install php 7.4 and 8.0 perfect.
My problem is that the server global version of php is the 8.0:
:~$ php -v
PHP 8.0.5 (cli) (built: May 3 2021 11:58:58) ( NTS )
And i need the original stable 7.3 because i have some projects that composer tell me has incompatible dependences with php8.0
how i can do this??
thank you so much.

User avatar
dpeca
Site Admin
Posts: 551
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
Re: How to change default php-cli version

Post by dpeca »

Globally:

Code: Select all

update-alternatives --config php
or

Code: Select all

update-alternatives --set php /usr/bin/php7.4
-----------------

Per user account:

Code: Select all

# be logged as desired user
alias php='php7.4'
echo "alias php='php7.4'" >> ~/.bashrc
source ~/.bashrc

gatto
Posts: 5
Joined: Fri May 07, 2021 10:56 pm
Re: How to change default php-cli version

Post by gatto »

wow thanks for your quick and great reply and support.


Post Reply