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

sandersjj's avatar

Unable to composer install due to php restrictions

Most of my sites on my server are still 7.3, but in the mean time I have also installed 7.4.

Now I have isntalled my first site on 7.4. But when I composer install that site I get an error that one of the packages requires 7.4 and my php version is 7.3. Am I missing something?

0 likes
5 replies
jlrdw's avatar

Update composer.json with the php 7.4.

sandersjj's avatar

My composer.json has in it: "php": "^7.4",. I am not sure what you are referring to.

jlrdw's avatar

Maybe the lock file problem, sometimes deleting vendor folder, then

  • composer clearcache
  • composer selfupdate
  • composer install

Does the trick.

But for more help show any errors.

sandersjj's avatar

Tried that too. But composer still gives me this:

 Root composer.json requires php ^7.4 but your php version (7.3.19) does not satisfy that requirement.

Also when I so php -v in my project root it returns 7.3 So maybe I need to change something in my forge config?

sandersjj's avatar
sandersjj
OP
Best Answer
Level 4

Hello All,

I fixed it by setting the default cli version in Forge to 7.4. Thanks everyone for the replies.

Please or to participate in this conversation.