Ok so had a very strange issue come up after upgrading my Macbook to macOS Monterey. To start with I was getting this error anytime I typed php -v on the command line:
zsh: command not found: php
Which obviously that is strange because php is 100% installed on my system. To Fix this we ran:
brew upgrade php
composer global update
valet use php@8.1
Everything ran correctly and I now had php 8.1 installed. When I typed php -v it returned my version of php on the command line as it should, but then we ran into a new issue. I pulled up the site I had been working on before this Monterey debacle and got this error message:
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0". You are running 7.4.26. in /Users/sam/repos/local-eats-laravel/vendor/composer/platform_check.php on line 24
Ummmm…. what the fuck, over? I’ve got 8.1 installed, it returns from the command line… but my web browser is still stuck using this old outdated php 7.4 (that’s strange) up until this point Valet had always properly taken care of syncing both versions of php. So now we went on the hunt to fix this issue, turns out – easy fix. Just run:
rm ~/.config/valet/valet.sock
valet restart
This removed a configuration file for Laravel Valet – that I guess was stuck using the old php 7.4 for some reason….. once valet restarted it picked up on the php 8.1 change and were good to go