To be more precise, I don't even see where PHP 7.1 is installed.
When I run php -v
in the terminal, I get:
PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
So I thought I would use Homebrew to unlink 7.1 and install 7.2. Should be straightforward. However, running brew unlink php71
returns an error saying:
No such keg: /usr/local/Cellar/php71
And, indeed, in /usr/local/Cellar
there is nothing resembling a PHP version.
I tried running brew update
and brew upgrade
just in case, but it didn't help.
I also tried running a PHP application locally and did phpinfo()
within the application, and I got the same version info I got in the console.
When I ran whereis php
it gave me the result /usr/bin/php
. When I ran whereis php71
it came up with nothing which, I suppose, is to be expected in this situation.
The question is, how do I replace PHP 7.1 with 7.2 in the least painful way? Ideally, I would like to get brew
to do this so I can update future version through brew
as well.
Mac OS has its own PHP version installed, which is complete independent from brew.
You need to force link your brew version.
brew link php@7.2 --force
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.