【发布时间】:2021-05-18 15:26:05
【问题描述】:
我已经使用自制软件安装了 PHP 7.4 的更新版本。
但是,当我在命令行上运行 php -v 时,我得到:
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
如您所见,它仍在使用 Mac Os 自带的那个。
当我从 php 脚本运行 phpinfo 时,我可以看到它使用的是正确的,正如我在 Apache 上配置的那样,如下所示。
我需要做什么才能让命令行使用 brew 安装的 PHP 版本?
【问题讨论】:
-
如果您想使用不同版本的
php,请使用它。引用所需二进制文件的路径,或调整 PATH 以首先找到该二进制文件。 -
试试这个用户的建议:stackoverflow.com/a/53785784/14612433Good Luck!
标签: php macos homebrew macos-big-sur