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?

prosti
  • 42,291
  • 14
  • 186
  • 151
Uttam Dutta
  • 5,250
  • 4
  • 18
  • 21
  • 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 '13 at 00:04
  • @Kzqai is it possible to compile this extension in travis, such as for PHP 5.3.3 in [my question](http://stackoverflow.com/q/38427977/4233593)? I see from [their cookbook](https://docs.travis-ci.com/user/languages/php/#Installing-additional-PHP-extensions) that you can install PECL extensions, but I don't think the openssl extension is available through PECL. – Jeff Puckett Jul 18 '16 at 17:54

14 Answers14

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.

totymedli
  • 29,531
  • 22
  • 131
  • 165
BorisS
  • 3,148
  • 1
  • 14
  • 12
  • I also had to enable the phar extension ( extension=php_phar.dll ) and as said below, the apache ssl module ! – Diego Favero Aug 12 '13 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 '13 at 07: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 '13 at 00:02
  • I am Using xampp, Composer giving the same open ssl missing error even after removing the ';' of openssl extension in php.ini. – Shashikumar Misal May 29 '14 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` – Prabowo Murti Aug 26 '14 at 06:17
  • how to edit this settings in shared hosting like godaddy – Abhijit Kumbhar Jan 02 '17 at 12:15
  • Try creating php.ini in your root folder as described here: http://stackoverflow.com/questions/16140917/how-to-access-the-php-ini-file-in-godaddy-shared-hosting-linux – BorisS Jan 02 '17 at 16:36
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."

Duramba
  • 389
  • 3
  • 8
26

make sure you have correct path to extension folder

extension_dir = "ext"

by default it is commented with ; character

Adam Kopciński
  • 505
  • 4
  • 12
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
Freddy Duarte
  • 177
  • 2
  • 9
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!

edigu
  • 9,878
  • 5
  • 57
  • 80
Athlan
  • 6,389
  • 4
  • 38
  • 56
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.

Andrew Koper
  • 6,481
  • 6
  • 42
  • 50
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

Mohammed Saqib Rajput
  • 1,331
  • 1
  • 14
  • 22
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

adang
  • 547
  • 4
  • 14
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.

Community
  • 1
  • 1
karlisup
  • 672
  • 12
  • 22
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.

RAS
  • 8,100
  • 16
  • 64
  • 86
codarrior
  • 524
  • 5
  • 5
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.

Shah Alom
  • 1,031
  • 1
  • 14
  • 26
0

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

tensor
  • 733
  • 1
  • 13
  • 22
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.

meti
  • 468
  • 1
  • 5
  • 27
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.

Kipruto
  • 721
  • 6
  • 16