Switch php versions on commandline ubuntu 16.04

前端 未结 16 1216
别那么骄傲
别那么骄傲 2020-11-30 16:53

I have installed php 5.6 and and php 7.1 on my Ubuntu 16.04

I know with Apache as my web server, I can do

a2enmod php5.6 #to enable php5
a2enmod php7.1         


        
16条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 17:22

    type this in your command line, should work for all ubuntu between 16.04, 18.04 and 20.04.

    $ sudo update-alternatives --config php
    

    and this is what you will get

    There are 4 choices for the alternative php (providing /usr/bin/php).
    
      Selection    Path             Priority   Status
    ------------------------------------------------------------
    * 0            /usr/bin/php7.2   72        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
    Press  to keep the current choice[*], or type selection number:
    

    Choose the appropriate version

提交回复
热议问题