Uninstall & install new PHP version
I had enough of shenanigans of installing PHP and failing to use it. Here’s a way I finally got it to work.
January 4, 2022
other
1brew unlink php@7.42brew install php3brew link php
You can be specific about which version of php you wish to delete / install.
If brew link php@whatever-version-installed
does not work, may need to try:
other
1vi .zshrc
This opens vim editor. We need to add following code to the editor:
other
1export PATH=$PATH:/usr/local/opt/php@8.0/bin
or
other
1export PATH="/usr/local/opt/php@8.1/bin:$PATH"
We need to source the file to apply new changes permanently.
other
1source .zshrc
Now try:
other
1php -v2which php
Or
At the end of the day, you can use Laravel Herd