I have already use WAMP 2.5 with PHP 5.5.12, and with Composer. The php is on:
C:\wamp\bin\php\php5.5.12
For new project, I need to use nginx and installed PHP 7. The php is on:
C:\nginx\php
Now, using GitBash MINGW32, I tried to install laravel 5.3 using Composer create-project
but it said
[InvalidArgumentException]
Could not find package laravel/laravel with version 5.3 in a version
installable using your PHP version 5.5.12.
I already put both C:\wamp\bin\php\php5.5.12
and C:\nginx\php
on Windows System PATH variable.
How do I change the PHP version used by Composer?
Three ways to do this, really.
.bashrc
to always run composer with the corresponding versionSomething like alias ncomposer=`/path/to/php /path/to/composer.phar `
composer.phar
itselfThis is specified at the start of the file: #!/path/to/php php
. Then composer should run with composer.phar
NB! The line will disappear upon self-update, so it's not a reliable solution.
If you place C:\nginx\php
first, it should be used by default when using composer.
Hope this helps!