Valet says I am not running the correct PHP version
Hi,
when attempting to get to my local site with valet I get
mysite.text
Gives me:
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.28. in vendor/composer/platform_check.php on line 24
When running php -v in my terminal I get PHP 8.2.3 and when running valet php --version I also get PHP 8.2.3
When I do, as stackoverflow says, use the composer install --ignore-platform-reqs (or the similar of changing my composer.json to not check platform requirements) I get another error when trying to access my site:
Parse error: syntax error, unexpected identifier "string", expecting variable in vendor/sebastian/version/src/Version.php on line 25
... and the weirdest thing is I have not been doing anything on my computer since last time I coded... and yet I get this š¤·āāļø
It seems like the issue is with the version of PHP that Composer is using. Try running composer install with the --ignore-platform-reqs flag to ignore the PHP version requirement. If that doesn't work, try updating Composer to the latest version.
If you're still having issues, try running which php to see which version of PHP is being used by your system. It's possible that Valet is using a different version of PHP than the one you're expecting. You can also try running valet use php to switch to a different version of PHP.
If none of these solutions work, you may need to reinstall Valet and/or PHP.
Example code:
composer install --ignore-platform-reqs
which php
valet use php