Composer 警告:缺少 openssl 扩展.如何在 WAMP 中启用如何在、Composer、openssl、WAMP

2023-09-08 08:33:50 作者:我一直在等你

尝试通过 Win7/64 + WampServer 2.2 安装 Composer 依赖管理工具Setup Installer 我收到以下消息:

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

缺少 openssl 扩展,会降低 Composer 的安全性和稳定性.如果可能,您应该启用它或使用 --with-openssl 重新编译 php

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

从我的托盘中的 Wamp 图标,单击 php >php 扩展 >php_openssl这表明通过在扩展程序旁边放置一个复选标记来完成任务然后我重新启动了 WampServer然后从托盘中的 Wamp 图标,我点击 php >php.ini 并搜索 openssl 以验证它没有被注释掉).不是.然后我回到 Composer-Setup.exe 并再次尝试.相同的警告消息:缺少 openssl 扩展"从未使用过 OpenSSL,我不确定应该设置什么,因此我尝试使用 https 浏览到我的本地站点之一.失败了. From my Wamp icon in Tray, clicked php > php extensions > php_openssl This showed that task was completed by placing a check mark beside the extension I then restarted WampServer 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. I then went back to Composer-Setup.exe and tried again. Same Warning Message: "openssl extension is missing" 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.

我错过了什么?

请指教.

推荐答案

WAMP 在 CLI 和 Apache 中使用不同的 php.ini 文件.当您通过 WAMP UI 启用 php_openssl 时,您为 Apache 启用它,而不是为 CLI 启用它.您需要修改 C:wampinphpphp-5.4.3php.ini 为 CLI 启用它.

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:wampinphpphp-5.4.3php.ini to enable it for the CLI.