Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Brainmaniac's avatar

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 šŸ¤·ā€ā™‚ļø

Any ideas?

0 likes
2 replies
LaryAI's avatar
Level 58

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
1 like
Brainmaniac's avatar
valet use php --force

I just had to do this!

1 like

Please or to participate in this conversation.