How to change PHP version used by composer
composer-php, php
Solution
You can change php version of composer without uninstalling it, follow these steps :
- Search for system environment variables in cortana.
- Click on the button "Environment variables".
- Under "System variables" select path and click on edit, you will see one entry like this "C:\wamp\bin\php\php5.6.13".
- Just change this to the folder name of the php located at your wamp/bin/php7.1.9, here php7.1.9 is folder name.
- Replace php5.6.13 with bin7.1.9, it will look like these "C:\wamp\bin\php\php7.1.9", just click ok on all the boxes.
- You are done.
- To verify, first close all the cmd windows, than open cmd and type `php -v`, press enter and you should see php7.1.9.
- If you don't see change in php version than just restart your pc and run `php -v` again in cmd , it will work.
Problem
I want to use another php version on my machine than the one already installed using WAMP `(2 PHP version installed)`. - The composer installed uses `PHP 5.6` - A new project requires `PHP7.0`. Whenever I choose PHP 7 from the control panel of WAMP and then run `php -v` it still printing `PHP5.6 (CLI)...` instead of `PHP7`. How can I use PHP7 without reinstalling the composer again?