6

I have composer installed on windows 8.1. I use it to download drupal distributions and modules. I have also installed acquia dev desktop. As you know that dev desktop comes with different versions of php and it has separate folders for it. I have setup composer to use php 5.6. How can I make it use php 7?

Should I uninstall composer and install again or what?

Umair
  • 638
  • 1
  • 5
  • 11
  • https://stackoverflow.com/questions/45790160/is-there-way-to-use-two-php-versions-in-xampp/45905822#45905822 may be useful. – Nigel Ren Mar 08 '18 at 17:10

3 Answers3

10

IF you have multiple php version installed in your system

you can run composer with different versions like

In linux

PHP

    usr/local/php usr/bin/composer install

for PHP 7.1

usr/local/php7.1 /usr/local/composer install

actually the idea is which version you wants to run get its bin path and then run the composer.

In Windows.

path/to/php.exe composer install

Hope this helps

FULL STACK DEV
  • 15,207
  • 5
  • 46
  • 66
7

If you just want to ignore the php version dependency then you can use this -

--ignore-platform-reqs

Example:

composer require symfony/css-selector --ignore-platform-reqs

This way you don't have to edit Environment variables(windows os) or using any full path of php etc. This very useful when I use different php lib from github which requires different php version set in my windows Environment variables though I have all PHP versions in my WAMP server so it will not be any problem running those lib after installing.

Codextent
  • 400
  • 5
  • 7
6

In my case worked with this:

ea-php72 /opt/cpanel/composer/bin/composer update
Erich García
  • 1,648
  • 21
  • 30