PHP版本的开关在Mac上不起作用 [英] Switch of php versions not working on mac
问题描述
我安装了High Sierra,并且它附带了php 7.1.在该环境中,我最终能够升级到php7.2,但无法对其进行文档记录,因此我不完全知道自己的所作所为.现在,我正在尝试切换到php 7.3
I have High Sierra installed and it comes with php 7.1. During the environment I ended up being able to upgrade to php7.2 but wasn't able to document it, so I dont exactly know what I did. Now, I am trying to switch to php 7.3
使用brew,我运行了以下命令:
Using brew, I ran the following commands:
brew unlink php@7.2
brew services install php@7.3
brew link php@7.3
如果我重新启动终端并检查php版本:
If I restart my terminal and check for the php version:
php -v
我仍然看到7.2.25版本,而不是我想要的7.3
I still see 7.2.25 version and not 7.3 as I desire
I also tried with a node package that I found in this link here but no success.
如何在php版本之间成功切换?
How do I successfully switch between php versions?
推荐答案
这是我的安装脚本:
-
简单安装php@7.2
-
brew链接--force php@7.2
-
酿酒服务启动php@7.2
-
导出PATH ="/usr/local/opt/php@7.2/bin:$ PATH"
-
导出PATH ="/usr/local/opt/php@7.2/sbin:$ PATH"
现在我的输出为:
$ php -v
PHP 7.2.25 (cli) (built: Nov 22 2019 10:27:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.25, Copyright (c) 1999-2018, by Zend Technologies
我认为 PATH
环境设置很重要.而且它确实会在安装过程中的说明中显示.
I think the PATH
environment setup is something matters. And it does show in instructions as part of the installation process though.
希望它有助于解决您的问题.
Hope it helps resolving your issue.
这篇关于PHP版本的开关在Mac上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!