I have a MultiPHP Manager on my WHM and I have installed Magento 2.2 with PHP 7.1.9. However, whenever I execute a simple cli command I receive an error Magento supports 7.0.2, 7.0.4 and 7.0.6 or later - see screenshot. How do I fix this?

enter image description here

  • run php -v and make sure the version is 7.1.9 on the same console. Sep 30, 2017 at 7:08
  • that says PHP 5.6.31 which is what is installed on my server Sep 30, 2017 at 7:12
  • So you got it. Your current PHP version is 5.6.x and M2.2 needs PHP 7.x. It's time to upgrade your PHP Sep 30, 2017 at 7:14
  • With the MultiPHP manager I have set the website to run on PHP 7.1.9. If I look at www.mydomain/info.php it says I am on 7.1.9 Sep 30, 2017 at 7:17
  • Please see my edit in the answer Sep 30, 2017 at 7:32

5 Answers 5


As you can see, still your PHP server is using 5.6.31 version. So you need to upgrade your PHP in order to use Magento 2.2


Your console is still relying on PHP version 5.6.x. It is true that using your MultiPHP manager you are running your site on version 7.x. But it means your apache PHP version is only changed. However, CLI is not relying on Apache configuration, which still relies on your default PHP setup. So you need to upgrade that too.

You can fix this in many ways. A good start is here. Then look for the best way that will work for you.

  • The website is running fine and wouldn't even be up and running if I was using PHP 5.6 as its not compatible with M2.2 Sep 30, 2017 at 7:21
  • See my edit please Sep 30, 2017 at 7:26
  • 1
    I can't upgrade the PHP version on my server as I still have Magento 1 websites. Is there another way to do this? I tried php7.1 bin/magento cache:clean but it doesn't recognize the command. Sep 30, 2017 at 7:33
  • 1
    I am not sure. Try to change the php version for the current shell session. Maybe this would help: stackoverflow.com/questions/31206864/… Sep 30, 2017 at 7:35
  • 1
    You put me in the right direction. I used the path to my PHP 7.1 binary then bin/magento cache:clean and it worked Sep 30, 2017 at 7:44

If the above approaches do not work (they did not work for me), explicitly recite the php version on the command line:

/usr/local/php71/bin/php /home/your-magento-directory/bin/magento cache:clear


/usr/local/php71/bin/php /home/your-magento-directory/bin/magento other-magento-command

Before running any php command on my vps with plesk panel I run:

export PATH=/opt/plesk/php/7.0/bin:$PATH


export PATH=/opt/plesk/php/7.1/bin:$PATH

After that

php bin/magento indexer:reindex

or any php magento command


When you have multiple PHP version on your server then you need to specify the php version in command line because from multiple PHP version, one PHP version is set as Default so please run below command for PHP7.1:

/opt/plesk/php/7.1/bin/php bin/magento cache:flush; /opt/plesk/php/7.1/bin/php bin/magento indxer:reindex;

Try it.


use this command for executing this specific command in PHP 7.2

/etc/php/7.2     php  /home/tm/dockercontainer/magento2folder/bin/magento sampledata:deploy

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.