-
-
Save vinaydotblog/6896317 to your computer and use it in GitHub Desktop.
# Goto a directory you can write to: | |
cd ~ | |
#get composer: | |
curl -s https://getcomposer.org/installer | php | |
# move composer into a bin directory you control: | |
sudo mv composer.phar /usr/local/bin/composer | |
# double check composer works | |
composer about | |
# (optional) Update composer: | |
sudo composer self-update |
First install php then try to run this command
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Will failed with error: The installation directory "/usr/local/bin" is not writable. So, need run php with sudo:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Usage: php
php -[b|c|n|h|i|q|s|v|?] [] [args...]
Run in LSAPI mode, only '-b', '-s' and '-c' are effective
Run in Command Line Interpreter mode when parameters are specified
-b address:port| Bind Path for external LSAPI Server mode
-c | Look for php.ini file in this directory
-n No php.ini file will be used
-h This help
-i PHP information
-l Syntax check
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-? This help
args... Arguments passed to script.
curl: (23) Failure writing output to destination
I was running this on docker alpine container. Was fine and now, all of a sudden its problematic.
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Now i got this issue```
bash: php: command not found
curl: (23) Failed writing body (0 != 16133)