I recently started playing more and more with PHP7.1.
To begin my experience, I started by aliasing on my command shell as follows:
alias php='/Applications/MAMP/bin/php/php7.1.0/bin/php -c "/Library/Application Support/appsolute/MAMP PRO/conf/php7.1.0.ini"'
I thought ok cool, with it being on my path as “php” composer will automatically pick up that version. However, it did not. I kept getting the following error message:
Your requirements could not be resolved to an installable set of packages. Problem 1 - package/name dev-master requires php ^7.0 -> your PHP version (5.6.28) does not satisfy that requirement. - package/name dev-master requires php ^7.0 -> your PHP version (5.6.28) does not satisfy that requirement. - Installation request for package/name *@dev -> satisfiable by package/name[dev-master].
Finally, I decided to do a bit more digging. In doing so, I determined that composer was getting PHP from my path. However, only an un-aliased version of it. This meant that it ended up pointing back to the base install of PHP 5.6.
So, what I needed to do to fix the problem, was to update the order in which it finds PHP on the path. More specifically, in my “.profile” file, I updated the PATH variable to say the following:
And that is all. I am now able to successfully run composer with PHP7.1.
Posted in php