I am using Magento 2.2.6, i am trying to run composer. but its shows php version error.

where as my php version is set correctly. please check the attached screenshot.enter image description here

please help me to fix this.

  • 1
    your php version is 5.6 Apr 2, 2019 at 19:38

2 Answers 2


You're trying to run composer with PHP5, I assume you got both PHP7 and PHP5 installed and it's defaulting to PHP5.

Since Magento 2 Minimum PHP Version is 7 See Minimum specs

You can find out what versions of PHP you got installed by running

  • Redhat Distros: rpm -qa | grep php

  • Debian Distros: apt list --installed | grep

Then when you try to run composer you can specify what PHP install you want it to use like so

php7.1 composer update

If that still does not work, are you sure you got the CLI interpreter for PHP 7 installed as well sudo add-apt-repository ppa:ondrej/php && sudo apt-get update && apt-get install php7.1-cli


Try executing command with ignore platform appended

$ composer install --ignore-platform-reqs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.