How to Install Composer

cd /data/download //Note: this directory must have execute permissions, otherwise an error will occur. I directly modified it: chmod -R 777 download

curl -sS https://getcomposer.org/installer | /usr/local/php/bin/php

Next, copy it to the executable directory /usr/local/bin

mv composer.phar /usr/local/bin/composer
composer config -g repo.packagist composer https://packagist.phpcomposer.com

composer -V

At this point, an error occurs: /usr/bin/env: php: No such file or directory

I searched around and found that this issue likely means the php executable file cannot be found. env will look for the php executable through the paths specified by $PATH.

My php executable file is actually located at /usr/local/php-7.0.14/bin/php, so we can create a symbolic link for this file:

ln -s /usr/local/php-7.0.14/bin/php    /usr/local/bin/php

composer -V

Leave a Comment

Your email address will not be published.