The OpenSSL extension is missing on Windows while installing Composer

Posted on

QUESTION :

While installing Composer for PHP, I get the following message:

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

How to fix this problem?

ANSWER :

@RiggsFolly has the right idea.

Additionally I had to:

  1. Copy php.ini-development to php.ini
  2. Uncomment the extension=php_openssl.dll line as described
  3. Uncomment this line:
    extension_dir = "ext"
  4. Make sure you find php_openssl.dll within that extension directory of course

All you need to do is activate the openssl extension in your php.ini by removing the ; comment from the line

;extension=php_openssl.dll

To

extension=php_openssl.dll

Warning, there are usually 2 php.ini files, one in the apachebin folder and one in the php folder, edit the one in the phpphp.ini folder as this is the one that controls PHP CLI.

If you’ve installed directly from php.net’s executable files for windows, the installation has no active php.ini file! You can confirm this using php -ini command in your console, it says C:Windows which actually has no ini file.

You should first rename one of php.ini-development or php.ini-production to php.ini and then uncomment the extension. (i.e. removeing semicolon before the extension=php_openssl.dll in that file.)

I tried setting the environment variable, without luck.. I did however try installing the Windows Binary from https://slproweb.com/products/Win32OpenSSL.html and it started working immediately (using Xampp, if that makes a difference..)

Leave a Reply

Your email address will not be published. Required fields are marked *