Problem installing composer on ubuntu with php versions

04/11/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)

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.