Question

I try to install an extension using the composer:

composer require magenest/module-worldpay-and-subscriptions:2.0.0

And get this:

  [InvalidArgumentException]
  Package magenest/module-worldpay-and-subscriptions at version 2.0.0 has a PHP requirement incompatible with your PHP version (5.4.45)

When I run the php -v command it returns:

PHP 5.4.45 (cli) (built: Nov 28 2017 10:34:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.0.4, Copyright (c) 2002-2017, by ionCube Ltd.
    with Zend OPcache v7.0.5, Copyright (c) 1999-2015, by Zend Technologies

However, I have all PHP version installed on my server so when I run a command I usually specify the PHP version beforehand, e.g. php-7.0 bin/magento

Also, when using fakechroot - it has PHP version set within the context of the domain group itself. e.g when I run this command: /usr/bin/fakechroot /usr/sbin/chroot /microcloud/domains/vampm2 /bin/bash and then php -v I get:

[http]$ /usr/bin/fakechroot /usr/sbin/chroot /microcloud/domains/vampm2 /bin/bash
bash-4.1$ php -v
PHP 7.0.26 (cli) (built: Dec 19 2017 17:26:19) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.0.4, Copyright (c) 2002-2017, by ionCube Ltd.
    with Zend OPcache v7.0.26, Copyright (c) 1999-2017, by Zend Technologies
bash-4.1$ exit

Can anyone tell me how can I run the composer require without composer to read the default PHP 5.4? Working on Magento ver 2.1.8

Was it helpful?

Solution 2

To run the composer in the specified PHP version I had to specify the PHP version I want to use and the full path the where I installed my composer. In my case the command looked like this now:

php-7.0 /usr/local/bin/composer require magenest/module-worldpay-and-subscriptions

OTHER TIPS

Another solution is to run composer with the --ignore-platform-reqs argument. Then it won't check system requirements like PHP version and PHP extensions.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top