After Mac OS full reinstall I perform php 8.0 install by brew install php
.
Unfortunately, brew didn't make this version active: php --version
report about 7.3 (not recommended version).
I cannot unlink this version because it's not installed by brew, so brew link
also doesn't have much sense.
How to bring latest php to system level and completely forget about php7.3 ?
Asked
Active
Viewed 2,306 times
2

Valery Bulash
- 445
- 4
- 22
-
1Does this answer your question? [Update PHP to 7.4 macOS Catalina with brew](https://stackoverflow.com/questions/64684713/update-php-to-7-4-macos-catalina-with-brew) – Nico Haase Apr 23 '21 at 07:44
-
Or this? https://stackoverflow.com/questions/20523183/how-to-use-the-php-that-brew-installed – Nico Haase Apr 23 '21 at 07:44
-
Or this? https://stackoverflow.com/questions/41872645/updating-php-version-on-mac/56942162 – Nico Haase Apr 23 '21 at 07:45
1 Answers
2
You'll need to tell your terminal where to find your new installed php.
export PATH="/usr/local/opt/php@8.0/sbin:$PATH"
And you need to add it to the bash_profile if you want all terminals to keep using your installed version.
echo 'export PATH="/usr/local/opt/php@8.0/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
This is for terminal use only. So not for your web servers.
In the future, when you install other versions, you can update the profile with:
nano ~/.bash_profile

Joeri
- 2,214
- 24
- 24
-
Just updated from php 7.4 to 8.1. Was asking myself why php7.4 was still running while typing php -v. Changed the path as mentioned above, and php 8.1 is working. – NME New Media Entertainment Apr 04 '22 at 20:45