Skip to content

Instantly share code, notes, and snippets.

@abedcodes
Last active October 26, 2021 13:28
Show Gist options
  • Save abedcodes/3e61c00fcc995b63ae27bfb84d9fcf1b to your computer and use it in GitHub Desktop.
Save abedcodes/3e61c00fcc995b63ae27bfb84d9fcf1b to your computer and use it in GitHub Desktop.
installing/upgrading composer on Ubuntu

i start to explain how to update composer, for installation start from step 3.

0. if you already installed composer you should be able to get composer version by running composer --version. if installed go to step 1.

1. run composer self-update if composer got updated then you are good to go but if you get error saying this command is undefined, it means you're composer is old(v1)

2. try removing the composer sudo apt purge composer

3. go to https://getcomposer.org/download/ & copy four lines of php commands & paste into your terminal press Enter

image

4. this is probably the tip of this gist run these commands

sudo mv composer.phar /usr/bin

cd /usr/bin

sudo mv composer.phar composer

now composer is installed globally, you can check by running composer command in any other directory

---extra steps---

php-curl extension helps with composer speed. install it by running sudo apt install php7.4-curl

beware: 7.4 is my installed php version. to know yours, run php -v if it is php 7.4.3 don't run sudo apt install php7.4.3-curl just php7.4-curl

confirm installation of curl extension by running: php -m | grep "curl"

best regards :)

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