silverstripe/silverstripe-installer

PHP dependency issue when installing

Closed this issue · 2 comments

Firstly, thanks for all your hard work.

I'm running 2 instances of xampp (not at the same time). one has php 5 and the other is running php 7 (two folders, two installs). I need to do this to make sure I can still work with my old websites.

When I try to do composer create-project silverstripe/installer silverdelta ^4 I get the following error even though I've checked that PHP 7 is running.
Could not find package silverstripe/installer with version 4 in a version installable using your PHP version 5.5.38

I know this may not be a SS issue but I'm really hoping you guys might have some ideas?

Cheers heaps

Hi @nimeso

There's a few things happening here:

  • composer in command line - this uses your system path to resolve any available binaries to execute, and when it finds one it will execute it.
  • Generally bin files like composer will start with a bash interpreter statement like #!/usr/env/php which tell your system which language to use to process the file. In my system the composer interpreter is #!/usr/bin/env php.
  • When you run /usr/bin/env php for example, you get the actual PHP implementation that is used to run composer. For example, /usr/bin/env php -v will show you the version of PHP that is executing composer.

To ensure that PHP 7 is used to execute composer in your local machine you have two options: (A) put it first in your system path (i.e. before the PHP 5 include path) rather than last, or (B) explicitly call it e.g. /usr/bin/my/php7/path/bin/php composer install. The first option will be much easier for you to maintain going forward.

You may also considering using a virtualised environment like Docker or Vagrant which you can contain your infrastructural requirements in without needing to worry about things like this.

Hope this helps! Closing as this isn't a SilverStripe problem. Cheers!

Thanks! You rock.