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

AtomCoder's avatar

PHP Version Issue

Hi Guys,

Just factory reset my iMac. Reinstalling everything.

My Laravel project is currently running on php version 7.4.9 on localhost. On my live server I'm running php 7.2

How can I change my php version on my localhost to match my live server?

I've used brew to uninstall all version of php and then reinstalled php 7.2. I then installed laravel valet, but my php version on my local laravel project still runs on php 7.4.9

0 likes
10 replies
dezineHQ's avatar

check php version in composer.json

and check version installed on your Mac

php -v in terminal

AtomCoder's avatar

Composer.json: php": "^7.1.3

On Mac: PHP 7.3.21

Laravel Project: PHP Version 7.4.9

dezineHQ's avatar
dezineHQ
Best Answer
Level 30

if you have multiple versions of php on your machine, you can tell valet what version to use

valet use php@version

To update project to use the same php v as machine

delete composer.lock update php version in composer.json composer install

1 like
AtomCoder's avatar

Did all that, Valet is now using php 7.2, but no matter what I do the phpinfo() function within my laravel project still show that its running on php 7.4.9

tykus's avatar

Is Valet actually serving the request?

AtomCoder's avatar

Yes I seen exactly that but it didn't change the phpinfo page.

Tried restarting valet etc.... Still no change.

However, I tried restarting my mac and its now displaying the correct php version.

Thanks for your help guys.

Please or to participate in this conversation.