Composer reading wrong PHP version (ACQUIA DEV DESKTOP on WINDOWS)

Composer reading wrong PHP version (ACQUIA DEV DESKTOP on WINDOWS)

3 posts / 0 new
Last post
INFO@WEBDEVFREAK.COM's picture
INFO
Points: 5
Composer reading wrong PHP version (ACQUIA DEV DESKTOP on WINDOWS)

I am trying to install a library https://github.com/thephpleague/csv via composer but getting following errors i.e

'This package requires php >= 5.5.9 but your php version <5.4.45> does not satisfy that requirement.'

My current PHP version is 5.6.30 but for some reason composer is showing <5.4.45> which is strange.

I am using ACQUIA DEV DESKTOP on WINDOWS and can switch between PHP versions easily and can check PHP version either by a) dpm(phpinfo()); or b) drush php which is showing same version as set in ACQUIA DEV DESKTOP.

This leads to an issue linked with the composer as it's reading a wrong PHP version.

Steps I have followed to install this library i.e

Copied composer.phar file from 'DevDesktop/tools' folder onto my Drupal project root and then via drush used 'composer require league/csv' which gives me this error ....

'This package requires php >= 5.5.9 but your php version <5.4.45> does not satisfy that requirement.'

'drush php' gives me this... 'Psy Shell v0.8.3 (php 5.6.30 cli) by Justin Jileman'

I have checked online resources for the similar errors but none of the solution out there matches my situation hence posting this question.

Not sure if this is linked to the issue but I have noticed 'DevDesktop\tools\drush.bat' have first line i.e

IF "%PHP_ID%"=="" (SET PHP_ID=php5_5)

which I changed to

IF "%PHP_ID%"=="" (SET PHP_ID=php5_6)

Stack stop/start and tried to download 'composer require lease/csv' but no change (same results).

Thanks in advance.

Status: 
Resolved
INFO@WEBDEVFREAK.COM's picture
INFO
Points: 5

Found a solution for this error and wanted to share so as it helps anyone else having same problem and possibly improve the solution as it seems to be a quick fix while it should be a universal fix :)

If you install Acquia DevDesktop software, composer comes with this by default.

From Acquia DevDesktop software, we can easily switch between php versions and can also set a default php version but that was not helpful when I try to download library via composer which kept on reading version 5.4.

As Acquia DevDesktop supports different PHP versions i.e 5.3, 5.4, 5.5, 5.6, 7. By default composer was reading php version 5.4 and I still need to find the file which needs to be modified so as default php version can be changed for composer.

In my case what I did was...

Go to Program Files > DevDesktop > tools folder.

There are 4 files having different extensions but same name i.e 'composer'. Remove these all files will remove composer from your system.

Download composer.exe from https://getcomposer.org/ and give it a target folder i.e 'Program Files > DevDesktop > php5_6' and install.

Once installed, now go to your project and by using command prompt or drush console, type 'composer require league/csv' which should download all files in your projects 'vendor' folder.

Status Change: 
Resolved
princemoga383@yahoo.com's picture
princemoga383
Points: 0