Composer、Windows 服务器和臭名昭著的 "SSL operation failed with code 1" 错误

Composer, Windows Server and the infamous "SSL operation failed with code 1" error

我目前正面临 Composer 的问题,据我所知,OpenSSL。在过去的几天里,我尝试了在网上找到的各种解决方案,但都没有成功。

开门见山,当我尝试使用 Composer 获取一些包时,有时会抛出以下错误:

... file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed

我在其他 Stack Overflow 帖子中看到的是这个问题与证书问题有关。正如建议的那样,我下载了一些证书 (https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt and https://curl.haxx.se/ca/cacert.pem) 并在我的 [= 中编辑了值 curl.cainfoopenssl.cafile 75=] 文件。不幸的是,它没有用。

我检查了环境变量,但没有 SSL_CERT_FILESSL_CERT_DIR 之类的东西。我尝试创建它们并为它们赋值,但没有成功。

我的系统是Windows Server 2019,我自己安装了PHP,但我也试过了使用 Wamp 安装。 CURLOpenSSLDLL 在这里,扩展在 php.ini 个文件。我安装Composer的时候也遇到这个错误,所以我手动安装了

我不知道该去哪里找了。有人有什么建议吗?

非常感谢。

此致,

解决方案

解决方案确实很简单:在我们的组织中,我们有自己的根证书和中间证书。我将它们与来自 https://curl.haxx.se/ca/cacert.pempem 文件合并,设置 php.ini 相应的文件,它解决了问题。

解决方案确实很简单:在我们的组织中,我们有自己的根证书和中间证书。我将它们与来自 https://curl.haxx.se/ca/cacert.pem 的 pem 文件合并,相应地设置 php.ini 文件,它解决了问题。