PHP → Composer uses outdated PHP version

In some cases Composer doesn’t use the actual version of PHP.

$ composer install
Problem 1
    - This package requires php >=5.6.31 but your PHP version (5.5.9)
      does not satisfy that requirement.
$ php -v
PHP 5.6.31 (cli)

It’s all because in first line of the executable Composer file we have:

#!/usr/bin/env php

All we need to do to fix it:

1. Either simply use: /path/to/specific/php composer.phar <command> for run

2. Or force Composer to use your version of PHP by update PATH= environment variable in your ~/.profile or ~/.bashrc file

What we should have:


Note that this will not automatically update your path for the current session. To do this, you should also run:

source ~/.profile 
source ~/.bashrc