In this tutorial I am going to provide steps on how to uninstall and install composer on ubuntu server.
of-course you can use it into your local ubuntu operating system as well.
Root cause of reinstalling composer:
The reason I am writing this tutorial because, I had an application running on production server for about 6-8 months which is using laravel framework and hosted on VPS server with Ubuntu 16.04 installed .
Today I wanted to update laravel application dependencies with composer update command, but for somehow I get exception showing below it could not allow me to update.
“continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”?
I did some research and find out that the issue is with current installed composer and the suggestion was to update it to latest on.
Good so far?
So I decided to update the composer, I know that it is easy we can just execute composer self-update command and we are done, but hold on we are done yet.
I had next issue, composer could not allow me to do self update, it was also giving me following Error Exception, here is how:
Here is the exception I got:
SHA384 is not supported by your openssl extension, could not verify the phar file integrity
So finally I figured out the issue behind all of this, it is with the current installed version of composer and it needs to be updated to execute composer command.
Let’s see how we can do that:
Un-installing composer is really easy you just have remove the composer.phar or composer file wherever it is located.
For me it was located inside user bin folder, so I deleted it using command below:
If you are not sure about location of composer file, then you can use following command to find out:
There are two ways installing composer first is by visiting https://getcomposer.org/download/ site and using the instruction and second is using the curl and here I am going to use the second way which I always prefer to use.
Use bellow command to download the latest composer.phar installer file:
curl -sS https://getcomposer.org/installer | sudo php
Move composer.phar to user bin directory to make it global, so we can access it from any project folder.
sudo mv composer.phar /usr/local/bin/composer
We done re-installing composer, if you type composer into your terminal you will see composer will show you the current version installed with all help option and available command:
Feel free to comment your questions of suggestions related to tutorial using comment box below.