我已阅读 How to enable PHP's openssl extension to install Composer?和 You must enable the openssl extension to download files via https
他们都声明 php 文件需要从位于这两个文件夹中的 php.ini 文件中取消注释 extension=php_openssl.dll
:
C:\wamp64\bin\apache\apache2.4.17
C:\wamp64\bin\php\php7.0.0
C:\wamp64\bin\php\php5.6.16 ' I don't think I need to, but did it any way
我已经完成了,然后重新启动了 PC。
WAMP 正在我的 Windows 10 机器上运行
尝试安装 Composer 时总是出现同样的错误
Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with --with-openssl
安装 Composer 需要做什么?
编辑
从 C:\PHP
(PHP 文件夹)我启动命令提示符并运行 php -r "phpinfo();"
在结果中,有以下内容:
OpenSSL support => disabled (install ext/openssl)
我关注了http://php.net/manual/en/faq.installation.php#faq.installation.addtopath
最佳答案
您安装了多个版本的 PHP:
- C:\wamp64\bin\php\php7.0.0
- C:\wamp64\bin\php\php5.6.16
- C:\PHP
- 您在 CLI 上运行的 PHP 版本基于您的环境 PATH 变量。第一个 PHP 路径获胜。
- 在 CLI 上运行
php --ini
。它会告诉你包含了哪个php.ini
以及 PHP 的路径- 编辑此
php.ini
文件并激活extension=php_openssl.dll
- 编辑此
- 然后运行
php -m
检查扩展是否加载 - 然后运行
composer
关于composer-php - 如何安装 Composer - 缺少 openssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36386635/