This tutorial worked for me, resolving my issues with /usr/local/bin permission issues and php-cli (which composer requires, and may aliased differently on shared hosting).
First run these commands to download and install composer:
cd ~
mkdir bin
mkdir bin/composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar bin/composer
Determine the location of your php-cli (needed later on):
which php-cli
(If the above fails, use which php
)
It should return the path, such as /usr/bin/php-cli, /usr/php/54/usr/bin/php-cli, etc.
edit ~/.bashrc and make sure this line is at the top, adding it if it is not:
[ -z "$PS1" ] && return
and then add this alias to the bottom (using the php-cli path that you determined earlier):
alias composer="/usr/bin/php-cli ~/bin/composer/composer.phar"
Finish with these commands:
source ~/.bashrc
composer --version
composer.phar
somewhere and make it executable. – Atoryvendor/
andcomposer.lock
to the shared host (like Kevin says below) – AtoryPHAR
file is to be executed by the PHP interpreter? It should not be extracted and certainly not opened by a browser. As others have stated if you don't have shell access (ssh) then your only bet is to use composer locally and then copy over thevendor/
directory. – Iridaceousvendor/
dir, it will save you a lot of trouble. – Iridaceous