沃梦达 / 编程问答 / php问题 / 正文

安装 Composer 失败并显示“缺少 openssl 扩展"错误

Install Composer fails with quot;The openssl extension is missingquot; error(安装 Composer 失败并显示“缺少 openssl 扩展错误)

本文介绍了安装 Composer 失败并显示“缺少 openssl 扩展"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 Composer,但出现以下错误:

I'm attempting to install Composer but I get the following error:

您机器上的某些设置使 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:

缺少 openssl 扩展,这意味着无法进行安全的 HTTPS 传输.如果可能,您应该启用它或使用 --with-openssl" 重新编译 php"

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"

然后我进入我的 php.ini-production 并取消注释:"extension=php_openssl.dll"

I have then gone into my php.ini-production and uncommented: "extension=php_openssl.dll"

这仍然不起作用,我还有什么需要做的吗?

This still doesn't work though, is there something else I have to do?

推荐答案

我怀疑php.ini-production"是一个适合现场环境的虚拟配置文件.在控制台执行 php -i 并找到 'php.ini' 路径,以查看它期望保存 ini 文件的位置.这通常需要php.ini",并且可能实际上不存在 - 如果不存在,请将 php.ini-development(或类似的)复制到所需的位置.

I suspect "php.ini-production" is a dummy configuration file suitable for live environments. Do a php -i at the console and find the 'php.ini' path, to see where it is expecting the ini file to be kept. This is normally expecting "php.ini", and may not actually exist - if it does not, copy php.ini-development (or similar) to the location required.

它位于(很长)输出的顶部附近,因此您可能会发现将其重定向到一个文件很有帮助(php -i > C:phpinfo.txt).

This is near the top of (a very long) output, so you may find redirecting it to a file helpful (php -i > C:phpinfo.txt).

这篇关于安装 Composer 失败并显示“缺少 openssl 扩展"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:安装 Composer 失败并显示“缺少 openssl 扩展"错误

基础教程推荐