127

I wanted to install Zend Framework 2. So I downloaded the skeleton application. As mentioned in the ZF2 manual, we have to issue the command

php composer.phar install 

Inside the skeleton.

But I'm getting an error

You must enable the openssl extension to download files via https

Then I enabled the ssl_module in my wamp, I checked the php_ini file and I can see the following line

extension=php_openssl.dll

Still I'm getting the same error. Anybody having any clue what I missed out?

2
  • 1
    I had this problem running travis-ci and it turned out that unlike every linux distro under the sun, some of the older travis-ci environments were compiled without openssl, just in case anyone else comes across the same problem.
    – Kzqai
    Jul 16, 2013 at 0:04
  • @Kzqai is it possible to compile this extension in travis, such as for PHP 5.3.3 in my question? I see from their cookbook that you can install PECL extensions, but I don't think the openssl extension is available through PECL. Jul 18, 2016 at 17:54

14 Answers 14

291

PHP CLI SAPI is using different php.ini than CGI or Apache module.

Find line ;extension=php_openssl.dll in wamp/bin/php/php#.#.##/php.ini and uncomment it by removing the semicolon (;) from the beginning of the line.

7
  • I also had to enable the phar extension ( extension=php_phar.dll ) and as said below, the apache ssl module ! Aug 12, 2013 at 19:37
  • 1
    "PHP CLI SAPI is using different php.ini than CGI or Apache module." That was the trick!
    – George D.
    Sep 16, 2013 at 7:57
  • If you can't find that line in your php.ini just simply add the line extension=php_openssl.dll under the Dynamic Extensions part in it.
    – totymedli
    Dec 11, 2013 at 0:02
  • I am Using xampp, Composer giving the same open ssl missing error even after removing the ';' of openssl extension in php.ini. May 29, 2014 at 11:37
  • If you are using Mac and port, you can select the PHP version by port select php php55 and install the extension port install php55-openssl Aug 26, 2014 at 6:17
36

Verify you are editing the correct php.ini file.

Reference: https://github.com/composer/composer/issues/1440

"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-X.Y.Z\php.ini to enable it for the CLI."

1
  • 2
    who would thought that... Really... This solved the problem. Thanks
    – Ruwantha
    Oct 3, 2013 at 2:21
26

make sure you have correct path to extension folder

extension_dir = "ext"

by default it is commented with ; character

4
  • 1
    this line was commented out completely and now it works Nov 25, 2014 at 17:19
  • important for windows installation!
    – haakym
    Mar 14, 2016 at 20:24
  • Where is this line? In which file? the php.ini in 1, C:\wamp64\bin\apache OR 2. C:\wamp64\bin\php\php7.0.0 ? Apr 3, 2016 at 14:54
  • This saved me hours of frustration, ssl was uncommented but this ext was not. Thank youuuuuuuuu!!!!
    – Kipruto
    Jul 23, 2023 at 16:23
11

I also had the same issue while playing around Zend Framework 2 and composer. I'm using PHP 5.4 (installed via macports) and my solution was to install openssl for PHP 5.4 via macports as well.

sudo port install php54-openssl
6

I have faced this problem, but configuging openssl (also for cli) did not help.

I have updated composer and this sloved my problem.

Just type:

$ php composer.phar self-update

or

$ composer selfupdate

Good luck!

5

I use XAMPP. In C:\xampp\php\php.ini, the entry for openssl did not exist, so I added "extension=php_openssl.dll" on line 989, and composer worked.

4

You need to enable "extension=php_openssl.dll" in both files (php and apache). my pc files path are these :

  1. C:\wamp\bin\php\php5.3.13\php.ini

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

1
  • This is wrong. Check with phpinfo() which php.ini is used Apr 21, 2015 at 12:38
3

Uttam, if your issue is not solved then try the follwoing 3 step approach. It worked for me as I had exactly same issue.

step1: click on wamp tray icon.

step2: goto menu apache->apache modules

step3: click on menu item "ssl_module"

it will automatically restart wamp. if wamp not restarted automatically then restart it through wamp tray menu-> Restart All services. After restart confirm that "ssl_module" coming as ticked under menu apache->apache modules

after that just attempt the php composer.phar install from going through the response shared by you, php.ini file contains extension=php_openssl.dll and the php/ext directory also have file "php_openssl.dll"

good luck

0
3

The Valery's answer helped me: https://stackoverflow.com/a/14265815/492457

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.

2

Make sure that you update your php.ini for CLI. For my case this was C:\wamp\bin\php\php5.4.3\php.ini and uncomment extension=php_openssl.dll line.

1

Late answer but adding so other can learn the reason.

You also need to edit the php.ini file in the "wamp\bin\php\php-X.Y.Z" location.

0

I had to uncomment extension=openssl in php.ini file for everything to work!

0

Becareful if you are using wamp don't use the wamp ui to enable the extension=php_openssl.dll

just go to your php directory , for example : C:\wamp\bin\php\php5.4.12 and edit the php.ini and uncomment the extension=php_openssl.dll.

it should work.

0

Was facing this error

"You must enable the openssl extension in your php.ini to load information from.."

I solved by finding and uncommenting the following lines on php.ini file

;extension=php_openssl 
;extension_dir = "/c:\wamp64\bin\php\php 8.0.25\ext\/"
;extension=bz2
;extension=curl
;extension=fileinfo
;extension=gd
;extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
;extension=mbstring
;extension=exif
;extension=pdo_sqlite
;extension=shmop

in

Wamp/bin/php/php 8.0.25/php.ini

Uncomment both by removing the semicolon (;) from the beginning of each line.

If you have the latest PHP v^8 or above, likely you won't see php.ini file. So what you do is to make a copy of php.ini-development which you will see there and then rename the copy you just made to php.ini and then do the same uncommenting of the two lines then save.

Not the answer you're looking for? Browse other questions tagged or ask your own question.