Open utterances-bot opened 3 years ago
After i did all of this nothing change, when i did php -v, i still have php 7.3
Very nice, man. I placed your function in my ~/.custom-alias file, (using ~/.zrhrc
and oh-my-zsh.)
For the previous commenter, did you remember to source your ~/.bash_profile
, ~/.bashrc
, ~/.zshrc` or wherever you configure your bash?
Some additional one-liners I found useful were:
ls -1 /usr/local/opt/ | grep php
And kind of separate but a little related:
alias | grep php
And finally:
print -rl -- ${(k)aliases} ${(k)functions} ${(k)parameters}
Or to see if this function is defined:
print -rl -- ${(k)aliases} ${(k)functions} ${(k)parameters} | grep php
Last two might be ZSH shell specific.
After i did all of this nothing change, when i did php -v, i still have php 7.3
you may need to force it:
valet use php@7.4 --force
Thanks a lot! This is so cool, using github to manage comments on your website. Utterances.
Thanks a lot! This is so cool, using github to manage comments on your website.
yeah it's eliminated all spam and it's a great way to manage replies
Thanks it’s worked now
awesome, thanks!
PS i always have the latest PHP version installed as well via the mainline php formulae, so it's kinda nice to alias switchphp 8.0
with switchphp latest
(or blank). then when homebrew upgrades php to 8.1 "latest" will map to that automatically.
switchphp() {
VERSION="${1:-latest}"
if [ "$VERSION" = "latest" ]
then
# set php to latest
brew unlink php && brew link --force --overwrite php
else
# set php to version specified
brew unlink php && brew link --force --overwrite php@$1
fi
}
If you use Laravel Valet then I highly recommend PHP Monitor https://github.com/nicoverbruggen/phpmon its Mac only, its a great GUI for switching php versions and showing other information
Switching between PHP versions with Homebrew - DC Blog Dev
With Homebrew it's possible to have multiple versions of PHP installed at once, to switch whi...
https://dcblog.dev/switching-between-php-versions-with-homebrew