2

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

2 Answers 2

10

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.

1
  • This answer should be accepted.
    – HoangHieu
    Nov 28, 2021 at 16:34
0

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

Your Answer

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

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