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

david001's avatar

php -v shows 7.4 but phpinfo(); shows 7.3

Hi, I have just cloned laravel 8 from GitHub. When I tried to access on the browser I got this error

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.33. in /Users/david/Project/laravel8/vendor/composer/platform_check.php on line 24

php -v in terminal shows PHP 7.4.28. but phpinfo() shows 7.3 I am using valet on mac

0 likes
14 replies
jlrdw's avatar

Each versions documentation will cover which version is required. I usually just look at the composer. Json file.

siangboon's avatar

php version in terminal and web server may different if you have multiple versions installed in your machine.

you need to check and configure your web server which version of php to used...

you did not mention your environment, I did not include any link for you but you can simply google it how to check and configure accordingly.

david001's avatar

@Sinnbeck Thanks, it worked but it shows PHP Version 8.1.3 I need 7.4 How can i do this again my terminal shows 7.4 , but phpinfo() shows8.1.3, I want to make it 7.4 too

ignium's avatar

@david001 This happened to me, but on Homestead instead of Valet (so this may not be the right direction). Your CLI (php -v) can be on a different version than the served version of PHP (what shows up in phpinfo()).

I'm not familiar with Valet, but for me on Homestead, the fix was to manually specify the version in the Homestead config file (in my case homestead.yaml). I'm not sure if that's an option with Valet, but if it is, that might be a good place to start.

1 like

Please or to participate in this conversation.