Composer curl错误60:SSL证书问题:证书链中的自签名证书

xxe27gdn  于 12个月前  发布在  其他
关注(0)|答案(2)|浏览(154)

我正在使用Symfony 5,我需要安装'knplabs/knp-snappy-bundle'与composer,但我有这个消息:

[Composer\Downloader\TransportException]
  curl error 60 while downloading https://repo.packagist.org/packages.json: SSL certificate problem: self signed certificate in certificate chain

字符串
请帮我
我尝试将cacert.pem添加到我的php.ini中,

curl.cainfo ="C:/wamp64/bin/php/php7.3.21/extras/ssl/cacert.pem"


我试图禁用composer.json中的verify_peer,但没有任何效果。
这是我的 composer Diag:

Checking composer.json: WARNING
require.composer/package-versions-deprecated : exact version constraints (1.11.99.1) should be avoided if the package follows semantic versioning

Checking platform settings: OK

Checking git settings: OK

Checking http connectivity to packagist: OK

Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 60 while downloading https://repo.packagist.org/packages.json: SSL certificate problem: self signed certificate in certificate chain

Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] curl error 60 while downloading https://api.github.com/rate_limit: SSL certificate problem: self signed certificate in certificate chain

Checking disk free space: OK

Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK

Checking composer version: FAIL
[Composer\Downloader\TransportException] curl error 60 while downloading https://getcomposer.org/versions: SSL certificate problem: self signed certificate in certificate chain

Composer version: 2.0.13
PHP version: 7.3.21
PHP binary path: C:\wamp64\bin\php\php7.3.21\php.exe
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020
cURL version: 7.70.0 libz 1.2.11 ssl OpenSSL/1.1.1g
zip: extension present, unzip present


请帮我
可能是我的 composer 配置有问题

"config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "options": {
            "ssl": {
                "verify_peer": false,
                "allow_self_signed": false,
                "cafile": "C:/wamp64/bin/php/php7.3.21/extras/ssl/cacert.pem",
                "local_cert": "C:/wamp64/bin/php/php7.3.21/extras/ssl/cacert.pem"
            }
        }

    },

w51jfk4q

w51jfk4q1#

这个配置选项:allow_self_signed来自任何地方,它没有任何效果;它甚至没有出现在composer的文档中。
由于这个误导性的选择,我失去了几个小时的宝贵时间。
如果你有类似的问题,我会建议使用最新版本的PHP(这符合您的要求,显然)和最新的 composer 版本等工程为我,但YMMV。

ct3nt3jp

ct3nt3jp2#

我遇到了同样的问题,并通过添加下面的代码片段将composer.json改为使用HTTP而不是默认的HTTPS
这不是一个好的做法,不要使用它,除非你真的别无选择。

"repositories": [
    {
        "packagist": false
    },
    {
        "type": "composer",
        "url": "http://repo.packagist.org/"
    }
]

字符串
我已经把在父目录的目录,我试图安装laravel在它。

相关问题