今天就跟大家聊聊有关ubuntu中切换php版本的方法,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

背景: ubuntu 更新时,选择,保留当前 php 版本,导致出现了 多个php 版本 ,phpinfo 显示的是 php7.1。在用 php -i 查看,发现,很多扩展打不开。

1. Ubuntu16.04中php如何切换版本

sudo update-alternatives --config php

选择 php7.3

2.停用 php7.1

sudo a2dismod php7.1# Module php7.1 disabled.

3.重启 apache :

systemctl restart apache2

To activate the new configuration, you need to run:

systemctl restart apache2

4. 查看 phpinfo 时,是 7.3,并且,扩展没有报错。

看完上述内容,你们对ubuntu中切换php版本的方法有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注亿速云行业资讯频道,感谢大家的支持。