[英]Downgrade from default PHP 7.1 to PHP 7 on macOS High Sierra
I have a fresh installation of macOS High Sierra
which comes with PHP 7.1.16
(Build date: Mar 31 2018 02:53:20) installed. 我有一个全新安装的
macOS High Sierra
,其中安装了PHP 7.1.16
(构建日期:2018年3月31日02:53:20)。 I would like to downgrade this to PHP 7.0.27
. 我想将其降级到
PHP 7.0.27
。
PHP 7.1.16
wasn't installed with homebrew
, so I assume it's not as easy as removing it and installing PHP 7
with brew
. PHP 7.1.16
没有安装homebrew
,所以我认为它不是移除和安装一样简单PHP 7
与brew
。
What is the best and safest way to do this? 最佳和最安全的方法是什么?
There's many resources to upgrade from PHP 7 -> 7.1 or 7 -> 7.2, but nothing to go the other way on macOS. 有许多资源可以从PHP 7-> 7.1或7-> 7.2升级,但在macOS上没有其他选择。
PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
The best solution as far for my purposes was the shell tool "update-alternatives". 就我而言,最好的解决方案是shell工具“ update-alternatives”。
With that you should be able to switch between diffrent php versions dependently on your project. 这样,您应该能够根据项目在不同的php版本之间进行切换。
So for example to switch to anohher php version set: 因此,例如切换到另一个版本的PHP:
update-alternatives --set php=path to your php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.