Search code examples
phpcentoscomposer-phpcentos7

Composer installed, but get /usr/bin/env: php: No such file or directory


On CentOS 7, I installed PHP 7.1.

Then I installed composer with:

cd /tmp
curl -sS https://getcomposer.org/installer | php71     --> used php71 instead of php, php didn't work
mv composer.phar /usr/local/bin/composer

Then, when using composer, I get:

/usr/bin/env: php: No such file or directory

When using sudo composer, I get:

sudo: composer: command not found

Solution

  • As @alexhowansky suggested in a comment, I ran the following command:

    sudo ln -s /usr/bin/php71 /usr/bin/php
    

    Now the composer command works.