ChatGPT解决这个技术问题 Extra ChatGPT

You must enable the openssl extension to download files via https

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?

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 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.

t
totymedli

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.


I also had to enable the phar extension ( extension=php_phar.dll ) and as said below, the apache ssl module !
"PHP CLI SAPI is using different php.ini than CGI or Apache module." That was the trick!
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.
I am Using xampp, Composer giving the same open ssl missing error even after removing the ';' of openssl extension in php.ini.
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
D
Duramba

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."


who would thought that... Really... This solved the problem. Thanks
A
Adam Kopciński

make sure you have correct path to extension folder

extension_dir = "ext"

by default it is commented with ; character


this line was commented out completely and now it works
important for windows installation!
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 ?
F
Freddy Duarte

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

e
edigu

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!


A
Andrew Koper

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.


M
Mohammed Saqib Rajput

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

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


This is wrong. Check with phpinfo() which php.ini is used
a
adang

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


C
Community

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.


R
RAS

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.


S
Shah Alom

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.


t
tensor

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


m
meti

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.


关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now