Problem installing composer on ubuntu with php versions

11/04/2017
Problem installing composer on ubuntu with php versions

The problem I raise is due to duality of php (cli), which means several versions of php are installed in our computer. In my case it had 5.3.29 and 5.5.9 versions. Composer needs php version > = 5.4.0
 

Install Composer

curl -sS curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

I get the following error:

Some settings on your machine make Composer unable to work properly.

Make sure that you fix the issues listed below and run this script again:

The openssl extension is missing, which means that secure HTTPS transfers are impossible.

If possible you should enable it or recompile php with --with-openssl
 

To solve it we can uninstall the PHP package we wish and leave the one which interests us. Another option would be updating the php alias, for example with the following sentence php = '/usr/bin/php5', in these cases the problem would already be solved .

The solution would be to change the php alias by php5

curl -sS https://getcomposer.org/installer | sudo php5 -- --install-dir=/usr/local/bin --filename=composer

NOTE: You must enable the openssl extension (php_openssl)