Search code examples
phpcomposer-phpacquia

How to switch php version when running composer?


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?


Solution

  • 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