How to enable PHP's openssl extension to install Composer?
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.
- Open a Command Prompt, type:
echo %PATH%
then check for the location of your PHP installation. - Go to that location and edit the file named:
php.ini
. - 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.
Solution 3
I had the same problem and here the solution I found, on your php.ini you need to do some changes:
extension_dir = "ext"
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
- 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
- Extract the zip file somewhere. I would suggest
C:\php
. Composer's installer found it there without any additional prompting - 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 tophp.ini
or copy it intophp.ini
.- php.ini-development
- php.ini-production
-
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.
Related videos on Youtube
FirmView
Updated on October 10, 2020Comments
-
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.
-
Rubens Mariuzzo over 10 yearsCheck for the path of PHP in the environment variable
%PATH%
, maybe Composer is looking for PHP in other location instead of WampServer.
-
-
Adrian P. over 10 yearsIt'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 about 10 yearswhen i type
echo %PATH%
I get:C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Sysem32\WindowsPowerShell\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 about 10 yearswamp 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 almost 10 yearsI am Using xampp, Composer giving the same open ssl missing error even after removing the ';' of openssl extension in php.ini.
-
Zabs almost 10 yearsBrilliant! Simple bullet point like response.. worked first time
-
Afnan Bashir over 9 yearsThanks 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 over 9 yearsI also had to uncomment the line
extension_dir = "ext"
inphp.ini
, but I'm using the plain PHP installation instead of WAMP. -
giannis christofakis over 8 yearsMen you are the only one that mentioned the
extension_dir
, you are great ! -
Brynn Bateman over 8 yearsAlternatively, 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 over 7 yearsThis worked for me. I had downloaded PHP directly like in this turtorial.
-
adamdehaven over 6 yearsThis is the ONLY place online with the correct solution (for a non-WAMP) setup. Thanks!
-
Bernhard Döbler almost 6 yearsIn what path do the files
libeay32.dll
orliblibcrypto-*.dll
reside? php.net/manual/de/openssl.installation.php -
Mike about 4 yearsFor 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 over 3 yearsFor anyone using a newer version of PHP: this line is now ;extension=openssl