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: 
    
  • 相关阅读:
    Redis 设计与实现 2:Redis 对象 redisObject
    Redis 设计与实现 1:数据库 redisDb
    KafkaProducer 简析
    G1 收集器
    KafkaMirrorMaker 的不足以及一些改进
    Redis 数据结构与对象编码 (Object Encoding)
    跨境 TCP 传输优化实录 — 使用 BBR 解决 LFN 问题
    TCP 协议简析
    使用模拟退火算法优化 Hash 函数
    LSM-Tree 与 B-Tree
  • 原文地址:https://www.cnblogs.com/shu-sheng/p/14448365.html
Copyright © 2011-2022 走看看