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
Using brew, I ran the following commands:
brew unlink [email protected]
brew services install [email protected]
brew link [email protected]
If I restart my terminal and check for the php version:
php -v
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.
How do I successfully switch between php versions?
To update the PHP version, update the brew using the command brew update . Then, use the command brew upgrade php . It upgrades the current version to the latest version of PHP. Then, restart the webserver to see the changes.
If you'd like to downgrade your PHP installation you can do so without interfering with the path to your installation and can simply overwrite older files. This process will overwrite your current PHP.
Here is my installation script:
brew install [email protected]
brew link --force [email protected]
brew services start [email protected]
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="/usr/local/opt/[email protected]/sbin:$PATH"
Now my output would be as:
$ 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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With