homestead cli 切换php版本


update-alternatives --display php

sudo update-alternatives --config php


vagrant@homestead:~$ update-alternatives --display php
php - manual mode
  link best version is /usr/bin/php7.3
  link currently points to /usr/bin/php7.3
  link php is /usr/bin/php
  slave php.1.gz is /usr/share/man/man1/php.1.gz
/usr/bin/php5.6 - priority 56
  slave php.1.gz: /usr/share/man/man1/php5.6.1.gz
/usr/bin/php7.0 - priority 70
  slave php.1.gz: /usr/share/man/man1/php7.0.1.gz
/usr/bin/php7.1 - priority 71
  slave php.1.gz: /usr/share/man/man1/php7.1.1.gz
/usr/bin/php7.2 - priority 72
  slave php.1.gz: /usr/share/man/man1/php7.2.1.gz
/usr/bin/php7.3 - priority 73
  slave php.1.gz: /usr/share/man/man1/php7.3.1.gz

vagrant@homestead:~$ sudo update-alternatives --config php
There are 5 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
  0            /usr/bin/php7.3   73        auto mode
  1            /usr/bin/php5.6   56        manual mode
  2            /usr/bin/php7.0   70        manual mode
  3            /usr/bin/php7.1   71        manual mode
  4            /usr/bin/php7.2   72        manual mode
* 5            /usr/bin/php7.3   73        manual mode

Press  to keep the current choice[*], or type selection number: 4
update-alternatives: using /usr/bin/php7.2 to provide /usr/bin/php (php) in manual mode