I’m running MacOS Catalina. I installed [email protected]
and now i want to change default from [email protected]
to [email protected]
.
I installed [email protected]
with this command:
brew install shivammathur/php/[email protected]
I tried to change the default php
with this command:
brew link --overwrite --force [email protected]
It output this:
Warning: Already linked: /usr/local/Cellar/php/8.0.2
To relink:
brew unlink php && brew link php
Afterwards I restart Apache and Terminal but When I get the version of PHP with this command:
php -v
O get this output:
PHP 7.4.15 (cli) (built: Feb 4 2021 12:11:40) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.15, Copyright (c), by Zend Technologies
Running in output on Terminal:
brew unlink php && brew link php
returns this output:
Unlinking /usr/local/Cellar/php/8.0.2... 24 symlinks removed.
Linking /usr/local/Cellar/php/8.0.2... 24 symlinks created.
After restarting Apache, I get this version of PHP:
PHP 7.4.15 (cli) (built: Feb 4 2021 12:11:40) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.15, Copyright (c), by Zend Technologies
3
Answers
after uninstalling
[email protected]
my problem solvedchecking
php
version:I have multiple versions of php installed on my mac and will switch it in ~/.zshrc depending on the project I am using.
Simply uncomment the one you want to use and comment the one you no longer wish to use. You would need to use brew to install the target version.
Close terminal then re-open for the change to take affect. Or run source ~/.zshrc
Based on Robert Saylor I exec:
Then checking
php
version: