Install new PHP:
Follow steps 1-3 from this guide
brew cleanup -s
Stop current php:
brew services stop php@7.1
Start the new service:
brew services start php@7.2
Link new PHP:
brew link --force --overwrite php@7.2
Update composer:
composer global update
Reinstall valet:
valet install
Remove Valets socket file and restart valet:
rm ~/.config/valet/valet.sock && valet restart
Common errors
Ruby framework error
If you get the error: "/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3 .0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- active_support/core_ext/object/blank (LoadError...."
Run:
brew style
libicui18n.60.dylib error
If you get the error "Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib", there are at least three solutions to test:
First try:
brew uninstall --ignore-dependencies node icu4c
brew install node
(from https://gist.github.com/berkedel/d1fc6d13651c16002f64653096d1fded)
If that doesn't work, try:
brew reinstall php@7.2
For a final solution, try:
brew uses --installed icu4c | xargs brew reinstall brew unlink php
(you may have to replace php@7.2 with your current version)
Php is already installed error
If you get the error: "Error: php 7.2.12_2 is already installed. To upgrade to 7.3.4, run `brew upgrade php`", run:
brew uninstall --force php
/usr/local/opt/php is not a valid keg error
If you get the error: "/usr/local/opt/php is not a valid keg" or similar, run
rm -rf /usr/local/opt/php