zoukankan      html  css  js  c++  java
  • 在已安装的PHP版本之间切换

    有两种方法:Apache2、CLI

    Apache2

    root@cky_test01:~# cd /etc/apache2/
    root@cky_test01:/etc/apache2# ls -l mods-*/*php*
    -rw-r--r-- 1 root root 867 Jan 12 06:03 mods-available/php5.6.conf
    -rw-r--r-- 1 root root 102 Jan 12 06:03 mods-available/php5.6.load
    -rw-r--r-- 1 root root 855 Oct  7 11:24 mods-available/php7.2.conf
    -rw-r--r-- 1 root root 102 Oct  7 11:24 mods-available/php7.2.load
    lrwxrwxrwx 1 root root  29 Dec 20 20:59 mods-enabled/php7.2.conf -> ../mods-available/php7.2.conf
    lrwxrwxrwx 1 root root  29 Dec 20 20:59 mods-enabled/php7.2.load -> ../mods-available/php7.2.load
    
    # 禁用
    root@cky_test01:/etc/apache2# a2dismod php7.2
    root@cky_test01:/etc/apache2# a2disconf php7.2-cgi
    # 启用
    root@cky_test01:/etc/apache2# a2enmod  php5.6
    root@cky_test01:/etc/apache2# a2disconf php5.6-cgi
    
    root@cky_test01:/etc/apache2# systemctl restart apache2
    

    CLI

    root@cky_test01:/etc/apache2# update-alternatives --set php /usr/bin/php5.6 
    update-alternatives: using /usr/bin/php5.6 to provide /usr/bin/php (php) in manual mode
    
    # 或者
    
    root@cky_test01:/etc/apache2# update-alternatives --config php
    There are 2 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.2   72        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number: 
    
  • 相关阅读:
    BZOJ2034 【2009国家集训队】最大收益
    「PKUSC2018」最大前缀和
    「PKUSC2018」真实排名
    【FJOI2016】建筑师
    【FJOI2014】最短路径树问题
    【HNOI2007】紧急疏散
    【TJOI2015】线性代数
    【SDOI2017】新生舞会
    POJ2079 Triangle
    【SDOI2011】工作安排
  • 原文地址:https://www.cnblogs.com/shu-sheng/p/14448365.html
Copyright © 2011-2022 走看看