137

Trying to install Composer dependency management tool on Win7/64 + WampServer 2.2 via the Setup Installer and I am getting the following message:

The openssl extension is missing, which will reduce the security and stability of Composer. If possible you should enable it or recompile php with --with-openssl

So here is what I did...

  1. From my Wamp icon in Tray, clicked php > php extensions > php_openssl
  2. This showed that task was completed by placing a check mark beside the extension
  3. I then restarted WampServer
  4. Then from the Wamp icon in tray, I clicked php > php.ini and searched for openssl to verifiy it was NOT commented) out. It was not.
  5. I then went back to Composer-Setup.exe and tried again. Same Warning Message: "openssl extension is missing"
  6. Having never worked with OpenSSL, I'm not sure what is supposed to be set, so I tried to browse to one of my local sites using https. It Failed.

What am I missing?

Please advise.

sleeper
  • 3,446
  • 7
  • 33
  • 50
  • Wow. I just went to google to try to get more info and this post showed up in search results. Already? Damn that was fast. :-} – sleeper Dec 27 '12 at 22:36
  • Did you restart the web server? – periklis Dec 27 '12 at 22:39
  • yes, I did restart the server. – sleeper Dec 27 '12 at 23:33
  • not sure how extensive you are trying to get with ssl but this may help out: http://www.phpjoel.com/2011/04/07/installing-ssl-using-openssl-on-a-wamp-localhost/. If that doesn't help you, you can always try the good old reinstall method of trouble shooting after you backup you DB and Files. – Cameeob2003 Dec 28 '12 at 01:10
  • I just upgraded my version on WampServer to the latest. Same message. I just kept on with the install. So far, no noticeable errors. Weird. – sleeper Dec 28 '12 at 03:11
  • It's quite possible, or even very likely, that the CLI version of PHP and the Apache version of PHP are using *different php.ini files*. Check phpinfo output from both. – Charles Dec 28 '12 at 05:28

13 Answers13

321

WAMP uses different php.ini files in the CLI and for Apache. when you enable php_openssl through the WAMP UI, you enable it for Apache, not for the CLI. You need to modify C:\wamp\bin\php\php-5.4.3\php.ini to enable it for the CLI.

Valery I.
  • 3,226
  • 1
  • 13
  • 2
  • 3
    you saved my love that i feel to laravel ... why the hell didn't they leave installationlike it was in old version :) – Tom Aug 01 '13 at 18:40
  • 1
    heck laravel brought me here – tomexsans Jul 03 '14 at 02:47
  • 1
    I am using uwamp where can I find the ini file. – Sujeet Kumar Jul 09 '14 at 11:43
  • Answer also works for EasyPHP (right-click system tray EasyPHP icon, select Configuration | PHP, which opens php.ini in Notepad, search for openssl, uncomment the line) – stifin Jan 21 '15 at 12:57
  • what should i do for xampp?.. I got the error like this Message could not be sent. Mailer Error: Extension missing: openssl ,,, – pcs May 29 '15 at 12:38
  • This answer leads to the proper action: enable openssl in the cli version of PHP, but lacks a crucial point: the composer installer will use the cli configuration of PHP (you can see it easily in advanced more). It may sound obvious for some, and not so obvious for others. – Fabien Haddadi Aug 30 '20 at 15:44
34

In addition to uncommenting the ;extension=php_openssl.dll line in php.ini that everyone else has mentioned, you also have to ensure the ;extension_dir = "ext" line is also uncommented. To uncomment, remove the prefixed semicolon and save.

That line might already be uncommented in packages like WAMP and XAMPP, but it's not in a plain PHP download for Windows, so it's worth verifying. Also, you have to create the php.ini file by copying one of the examples, like php.ini-development to a new file and then name it php.ini. Then make these changes there.

Also, in the future, to install tools such as PHP and Composer, I recommend using the Chocolatey package manager. Then it's as simple as choco install composer. Of course, you'd still need to edit php.ini before installing Composer with the choco method. In future versions of Windows, package management tools like Chocolatey will be baked into Windows, the same way apt-get is in Ubuntu. Exciting times ahead for developers!

With either method, after installing Composer, don't forget to restart your terminal. Whether you're using Command Prompt, Bash (installs with Git), or Powershell, you'll need to restart it before the updated environmental variables work.

Scott Pigeon
  • 341
  • 3
  • 2
  • 4
    This is the correct answer if you are trying to install composer on Windows 10and have followed this [guide](http://drivemarketing.ca/en/blog/installing-composer-on-windows-10/) – robped Dec 04 '16 at 12:35
16

I had the same problem even though openssl was enabled. The issue was that the Composer installer was looking at this config file:

C:\wamp\bin\php\php5.4.3\php.ini

But the config file that's loaded is actually here:

C:\wamp\bin\apache\apache2.2.22\bin\php.ini

So I just had to uncomment it in the first php.ini file and that did the trick. This is how WAMP was installed on my machine by default. I didn't go changing anything, so this will probably happen to others as well. This is basically the same as Augie Gardner's answer above, but I just wanted to point out that you might have two php.ini files.

regularmike
  • 1,167
  • 10
  • 22
12

uncomment ;extension=php_openssl.dll in both

wamp\bin\php\php5.4.12\php.ini
wamp\bin\apache\Apache2.4.4\bin\php.ini

it will work

vuhung3990
  • 6,353
  • 1
  • 45
  • 44
  • I m using xampp.. so i edited 2 files named, c/php/php.ini and c/apache/bin/php.ini.. removed semicolon in this ;extension=php_openssl.dll .. but still stays same error like this Mailer Error: Extension missing: openssl.. – pcs May 29 '15 at 12:43
  • @saina did you restart your server? Also run phpinfo() to check where the configuration file is located. – Ivanka Todorova Jun 23 '15 at 13:24
5

C:\laravel-master>composer create-project laravel/laravel Installing laravel/laravel (v4.0.6) - Installing laravel/laravel (v4.0.6) [RuntimeException] You must enable the openssl extension to download files via https

I'm using EasyPhp (WAMP type). In the EasyPHP Icon in the taskbar, right click and select configuration then select PHP. I will open the PHP.ini file configuration in a Notepad, search-find or CTRL+F in notepad for the word OPENSSL you will find this ;extension=php_openssl.dll just remove the ; and the extension=php_openssl.dll is active.

C:\laravel-master>composer create-project laravel/laravel Installing laravel/laravel (v4.0.6) - Installing laravel/laravel (v4.0.6) Downloading: 100% Created project in C:\laravel-master\laravel Loading composer repositories with package information Installing dependencies (including require-dev)

Brad Mace
  • 27,194
  • 17
  • 102
  • 148
voltronluis
  • 51
  • 1
  • 2
  • I know it is off-topic , but how you have composer installed with EasyPhp.I only get errors and have to re-install all. – HenryW Jan 09 '14 at 14:03
2

you need to edit the "c:\Program Files\wamp\bin\php\php5.3.13\php.ini" file search for: ;extension=php_openssl.dll

remove the semicolon at the beginning

note: if saving the file doesn't work then you need to edit it as administrator. (on win7) go to start menu, search for notepad, right-click on notepad, click "Run As Administrator"

in the composer installation windows just click back then next (or close it and start again) and it should work

2

opened wamp/bin/apache/apache2.4.4/bin/php config.. wamp/bin/php/php5.4.16/php conf settings, php-ini production, php-ini dev, phpForApache find extension=php_openssl.dll and uncomment by removing ;

  • possible duplication of http://stackoverflow.com/questions/14062055/composer-warning-openssl-extension-is-missing-how-to-enable-in-wamp – blackmind Apr 29 '15 at 18:07
1

Short and sweet, uncomment this line in wamp/bin/php/php5.3.13(or whatever php version):
;extension=php_openssl.dll (remove the ;)
Now run the command line installation of Composer. You won't have an error.
Good to go!

Augie Gardner
  • 2,749
  • 3
  • 25
  • 36
1

You should make a symlink to php.ini. Sorry for russian link.

Alex Pliutau
  • 21,392
  • 27
  • 113
  • 143
1

Yes, you must have to open php.ini and remove the semicolon to:

;extension=php_openssl.dll

remove the ";" like this and it will work.

extension=php_openssl.dll

Happy Coding.

Sujeet Kumar
  • 1,280
  • 1
  • 17
  • 25
0

For installing Composer below steps worked me:(WAMP version 2.4 x64bit)

edit ->
**C:\wamp\bin\php\php5.4.12\php.ini**
;;uncomment below line or remove the semicolons ';'
extension=php_openssl.dll

**C:\wamp\bin\apache\Apache2.4.4\bin\php.ini**

extension=php_openssl.dll
Ram
  • 3,092
  • 10
  • 40
  • 56
sherpaurgen
  • 3,028
  • 6
  • 32
  • 45
0

All those answers are good, but in fact, if you want to understand, the extension directory need to be right if you want all you uncommented extensions to work. Can write a physical or relative path like

extension_dir = "C:/myStack/php/ext"

or

extension_dir = "../../php/ext"

It's relative to the httpd.exe Apache web server (C:\myStack\apache\bin) But if you want it to work with Composer or anything you need the physical path because the cli mode doesn't use the web server !

François Breton
  • 1,158
  • 14
  • 24
0

I was facing the same issue. I renamed my php folder from php7_winxxxx to just php and it worked fine. It looked like composer was checking the location to the php_openssl module in c:/php/ext.

You may also need to add c:/php to the PATH in environment variable

tushortz
  • 3,697
  • 2
  • 18
  • 31