3

I have read How to enable PHP's openssl extension to install Composer? and You must enable the openssl extension to download files via https

They both state that the php file needs to uncomment extension=php_openssl.dll from the php.ini files which live in both these folders:

C:\wamp64\bin\apache\apache2.4.17
C:\wamp64\bin\php\php7.0.0
C:\wamp64\bin\php\php5.6.16          ' I don't think I need to, but did it any way

I've done that, and then restarted the PC.

WAMP is running on my Windows 10 machine

The same error always shows when trying to install Composer

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

What do I need to do to install Composer?

Edit

From C:\PHP (the PHP folder) I started a command prompt and ran php -r "phpinfo();"

In the results, there is the following:

OpenSSL support => disabled (install ext/openssl)

I have followed http://php.net/manual/en/faq.installation.php#faq.installation.addtopath

Community
  • 1
  • 1
MyDaftQuestions
  • 4,487
  • 17
  • 63
  • 120
  • make sure you're editing the correct .ini file, and dont forget to restart apache. maybe this will help: http://stackoverflow.com/a/14447063/2460773 – Nitsan Baleli Apr 03 '16 at 14:42
  • @NitsanBaleli, I'm not sure how the link you've kindly provided differs from the second file path in my post :s – MyDaftQuestions Apr 03 '16 at 14:44
  • Run `php -r "phpinfo();"` in the command line and make sure openssl is enabled. WAMP uses different php.ini file in console mode. If not you can find location of the used php.ini within the output of phpinfo call. – Mike Doe Apr 03 '16 at 15:07
  • hmm, @mike, it shows `OpenSSL support => disabled (install ext/openssl)`.. I have done http://php.net/manual/en/faq.installation.php#faq.installation.addtopath – MyDaftQuestions Apr 03 '16 at 15:49
  • Find the php.ini used in the command line by PHP and remove the semicolon before extension=php_openssl.dll – Mike Doe Apr 03 '16 at 17:57
  • @mike, I have 2 files, one called `php.ini-production` and the other called `php.ini-development`. `php.ini-production` already has this, the `php.ini-development` is totally commented (every line in the file starts with `;`). Still, I removed this one comment, same issue (but thanks for staying with me) – MyDaftQuestions Apr 03 '16 at 18:38
  • 1
    @NitsanBaleli restarting Apache is not needed to change CLI settings as a new PHP instance is implicitly started on every CLI invocation. – Niels Keurentjes Apr 03 '16 at 22:53
  • @MyDaftQuestions those 2 are the blueprint samples for a typical development or production scenario. Rename the one you want (usually development) to `php.ini` to actually make PHP load it, then edit it. Currently it's not loading either of them. – Niels Keurentjes Apr 03 '16 at 22:54
  • Did you follow my instructions? In the phpinfo()'s output in the command line you will find the path to the USED php.ini file. `php -r "phpinfo();" | findstr Loaded` – Mike Doe Apr 04 '16 at 07:40
  • @NielsKeurentjes, I renamed the `php.ini-production` to `php.ini` and composer is installed! Thank you, can you move your comment to an answer? – MyDaftQuestions Apr 06 '16 at 13:26

1 Answers1

0

You have multiple version of PHP installed:

  1. C:\wamp64\bin\php\php7.0.0
  2. C:\wamp64\bin\php\php5.6.16
  3. C:\PHP

  • The PHP version, which you run on the CLI is based on your environment PATH variable. The first PHP path wins.
  • run php --ini on the CLI. It will show you which php.ini is included and also the path of PHP
    • edit this php.ini file and activate the extension=php_openssl.dll
  • then run php -m to check, if the extension is loaded
  • then run composer
Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141