How to enable PHP's openssl extension to install Composer?

304,725

Solution 1

It is possible that WAMP and Composer are using different PHP installations. Composer will use the PHP set in the PATH environment variable.

If you want to enable the openssl extension to install Composer, first you need to check the location of the PHP installation.

  1. Open a Command Prompt, type: echo %PATH% then check for the location of your PHP installation.
  2. Go to that location and edit the file named: php.ini.
  3. Uncomment the line extension=php_openssl.dll by removing the semicolon at the beginning.

Now you are good to install Composer.

Solution 2

I solved my problem a different way. The problem is that wamp's GUI was misleading: it claimed that I had php_openssl enabled.. and if I clicked on php.ini on the same GUI.. it actually showed that extension=php_openssl.dll was uncommented..

I'm not sure if i'm using the same installer version of composer of the OP, but it actually asks you at the beginning to specify the php.exe that you like to apply composer on (which basically ensures that no one tries to apply composer to the wrong php executable as what happened with the OP)..

The way I solved this was by going myself into the installation of php within the wamp package: C:\wamp\bin\php\php5.4.12 and looking php.in there.. when I opened it I was shocked that the line extension=php_openssl.dll was actually commented! I uncommented it and it worked just fine.

enter image description here

Solution 3

I had the same problem and here the solution I found, on your php.ini you need to do some changes:

  1. extension_dir = "ext"
  2. extension = php_openssl.dll

Every one here talks active the openssl extension, but in windows you need to active the extension dir too.

Solution 4

For WAMP server, comment given by "Enrique" solved my problem.

wamp is using this php.ini:

c:\wamp\bin\apache\Apache2.4.4\bin\php.ini

But composer is using PHP from CLI, and hence it's reading this file:

c:\wamp\bin\php\php5.4.12\php.ini (so you need to enable openssl there)

For composer you will have to enable extension in

c:\wamp\bin\php\php5.4.12\php.ini

Change:

;extension=php_openssl.dll 

to

extension=php_openssl.dll

Solution 5

If you're doing this on Windows without one of the WAMP stacks, here's how to get this going

  1. Download an installation of PHP for Windows. Generally you'll want a non-thread safe install. You can use 32-bit or 64-bit builds
  2. Extract the zip file somewhere. I would suggest C:\php. Composer's installer found it there without any additional prompting
  3. The latest versions of PHP for Windows do not come with a php.ini by default. Instead, you'll see two files, as noted below. Rename one to php.ini or copy it into php.ini.
    • php.ini-development
    • php.ini-production
  4. Open your php.ini file and remove the semicolon from this line (you might want to uncomment other things as well but this line is the only one necessary for Composer)

    ;extension=php_openssl.dll
    

That should be all you need to do. The Composer installer should do everything else you need from here.

Share:
304,725

Related videos on Youtube

FirmView
Author by

FirmView

Updated on October 10, 2020

Comments

  • FirmView
    FirmView over 3 years

    I am trying to install Laravel in WAMP setup. I am getting a warning message for not enabling openssl which I had already done in WAMP.

    Here is a screenshot of the message.

    enter image description here

    • Rubens Mariuzzo
      Rubens Mariuzzo over 10 years
      Check for the path of PHP in the environment variable %PATH%, maybe Composer is looking for PHP in other location instead of WampServer.
  • Adrian P.
    Adrian P. over 10 years
    It's happen I do not have this extension on my XAMPP installation. I just added (extension=php_openssl.dll) on the php.ini and it is working downloading laravel dependencies.
  • abbood
    abbood about 10 years
    when i type echo %PATH% I get: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\W‌​indows\Sysem32\Windo‌​wsPowerShell\v1.0\;C‌​:\Program files\Microsoft\Web Platform Installer\;C:\Program Files\MySQL\MySQL Server 5.5\bin.. there isn't any php installed in any of those directories.. what do i do now?
  • Enrique
    Enrique about 10 years
    wamp is using this php.ini: c:\wamp\bin\apache\Apache2.4.4\bin\php.ini but composer is using PHP from CLI, and hence it's reading this file: c:\wamp\bin\php\php5.4.12\php.ini (so you need to enable openssl there)
  • Shashikumar Misal
    Shashikumar Misal almost 10 years
    I am Using xampp, Composer giving the same open ssl missing error even after removing the ';' of openssl extension in php.ini.
  • Zabs
    Zabs almost 10 years
    Brilliant! Simple bullet point like response.. worked first time
  • Afnan Bashir
    Afnan Bashir over 9 years
    Thanks after having to look at this answer i figured out wamp was using 5.5.12 but i selected 5.4 directory for php.exe
  • David Harkness
    David Harkness over 9 years
    I also had to uncomment the line extension_dir = "ext" in php.ini, but I'm using the plain PHP installation instead of WAMP.
  • giannis christofakis
    giannis christofakis over 8 years
    Men you are the only one that mentioned the extension_dir, you are great !
  • Brynn Bateman
    Brynn Bateman over 8 years
    Alternatively, mine did not have a default. Just copy/paste the prod/dev one and rename it to php.ini, then make the edits others have suggested here.
  • robped
    robped over 7 years
    This worked for me. I had downloaded PHP directly like in this turtorial.
  • adamdehaven
    adamdehaven over 6 years
    This is the ONLY place online with the correct solution (for a non-WAMP) setup. Thanks!
  • Bernhard Döbler
    Bernhard Döbler almost 6 years
    In what path do the files libeay32.dll or liblibcrypto-*.dll reside? php.net/manual/de/openssl.installation.php
  • Mike
    Mike about 4 years
    For MAMP, I had to copy the php.ini file from C:\MAMP\conf\phpx.x.x to C:\MAMP\bin\php\phpx.x.x (\conf\.... to \bin\...)
  • Vern Jensen
    Vern Jensen over 3 years
    For anyone using a newer version of PHP: this line is now ;extension=openssl