#development #linux #php #terminal

Today, it's about a simple task: switching PHP versions on the command line in Ubuntu:

1sudo update-alternatives --set php /usr/bin/php8.1

It works the same for the other PHP commands:

1sudo update-alternatives --set phar /usr/bin/phar8.1
2sudo update-alternatives --set phar.phar /usr/bin/phar.phar8.1
3sudo update-alternatives --set phpize /usr/bin/phpize8.1
4sudo update-alternatives --set php-config /usr/bin/php-config8.1