Re: How to change default php-cli version
Posted: Thu May 27, 2021 6:04 pm
Globally:
or if you know exact version:
-------------------------------------------------------------------------------------
Per user account:
This method does not always give the desired result, in that case you have to globally change the PHP version, perform the desired task, and then restore the old PHP version.
For wp-cli you can change PHP version this way - viewtopic.php?f=18&t=760
Code: Select all
# be logged as root
update-alternatives --config php
Code: Select all
# be logged as root
update-alternatives --set php /usr/bin/php8.2
Per user account:
Code: Select all
# be logged as desired user
alias php='php8.2'
echo "alias php='php8.2'" >> ~/.bashrc
source ~/.bashrc
For wp-cli you can change PHP version this way - viewtopic.php?f=18&t=760