Skip to content

Instantly share code, notes, and snippets.

@vinaydotblog
Last active April 17, 2023 11:08
Show Gist options
  • Save vinaydotblog/6896317 to your computer and use it in GitHub Desktop.
Save vinaydotblog/6896317 to your computer and use it in GitHub Desktop.
Installing composer using curl
# 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
@Yannick243
Copy link

First install php then try to run this command
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Copy link

ghost commented Apr 7, 2020

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

@w3servicesdotnet
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment