Laravel Homestead:切换 PHP 版本(PHP 命令行) 0 个改进

Homestead 中使用此命令:

$ sudo update-alternatives --config php

会弹出选项:

$ sudo update-alternatives --config php
There are 7 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.0   80        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
* 6            /usr/bin/php7.4   74        manual mode
  7            /usr/bin/php8.0   80        manual mode

Press <enter> to keep the current choice[*], or type selection number:

填入数字:

$ sudo update-alternatives --config php
There are 7 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.0   80        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
* 6            /usr/bin/php7.4   74        manual mode
  7            /usr/bin/php8.0   80        manual mode

Press <enter> to keep the current choice[*], or type selection number: 7
update-alternatives: using /usr/bin/php8.0 to provide /usr/bin/php (php) in manual mode

命令行确认一下:

$ php -v
PHP 8.0.1 (cli) (built: Jan 13 2021 08:22:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.1, Copyright (c), by Zend Technologies
本文为 Wiki 文章,邀您参与纠错、纰漏和优化
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!