AWS SSL security error : [curl] 60: SSL certificate prob…: unable to get local issuer certificate

后端 未结 5 1490
我在风中等你
我在风中等你 2020-12-15 17:07

I am trying to connect Amazon\'s S3 files from my (localhost) Windows 8 machine running AppServ 2.5.10 (which includes Apache 2.2.8, php 5.2.

相关标签:
5条回答
  • 2020-12-15 17:30

    As mentioned by Jeremy Lindblom in the comments, the solution for AWS SDK v2 is to set the ssl.certificate_authority option when instantiating the SDK:

    $aws = Aws\Common\Aws::factory(array(
        'region' => 'us-west-2',
        'ssl.certificate_authority' => '/path/to/updated/cacert.pem'
    ));
    

    http://docs.aws.amazon.com/aws-sdk-php/guide/latest/faq.html#what-do-i-do-about-a-curl-ssl-certificate-error


    I'll add that this was changed in the AWS SDK v3, here is the new method:

    $client = new DynamoDbClient([
        'region'  => 'us-west-2',
        'version' => 'latest',
        'http'    => [
            'verify' => '/path/to/my/cert.pem'
        ]
    ]);
    

    http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html#verify

    0 讨论(0)
  • 2020-12-15 17:35

    I was getting the same error If you want to use http then you can use below solution:

     Error executing "PutObject" on "https://s3-ap-southeast-2.amazonaws.com/mybucketname/TestBanner1_e1d8d74e41"; AWS HTTP error: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
    

    I have resolved it by using http method this is not secure to use secure way enter _ curl.cainfo = "/path/to/file.cacert.pem"_ in php.ini file :

    Solution:

    'options' => [
    'scheme' => 'http',
    ],
    

    Complete Example code:

     // ...
    's3bucket' => [
    'class' => \frostealth\yii2\aws\s3\Storage::className(),
    'region' => 'ap-southeast-2',
    'credentials' => [ // Aws\Credentials\CredentialsInterface|array|callable
    'key' => 'JGUTEHCDE.............OSHS',
    'secret' => 'SJEUC-----------jzy1-----rrT',
    ],
    'bucket' => 'yours3bucket',
    //'cdnHostname' => 'http://example.cloudfront.net',
    'defaultAcl' => \frostealth\yii2\aws\s3\Storage::ACL_PUBLIC_READ,
    'debug' => false, // bool|array
    'options' => [
    'scheme' => 'http',
    ],
    
    ],
    // ...
    
    0 讨论(0)
  • 2020-12-15 17:36

    I have Very Simple Solution of this problem. You can do this without any certificate file..

    Go on Laravel Root Folder -> Vender -> guzzlehttp -> guzzle -> src

    open Client.php

    find $defaults Array . that look like this way ..

    $defaults = [
        'allow_redirects' => RedirectMiddleware::$defaultSettings,
        'http_errors'     => true,
        'decode_content'  => true,
        'verify'          => true,
        'cookies'         => false
    ];
    

    Now main Job is to change value of verify key ..

    'verify'          => false,
    

    So After this it will not check SSL Certificate for CURL Request... This Solution is work for me. I find this solution after many research ...

    0 讨论(0)
  • 2020-12-15 17:42
    $s3 = new S3Client
             ([
                'version' => 'latest',
                'scheme' =>'http',
                'region'  => $this->config->item('s3_region'),
                'credentials' => [
                    'key'    => $this->config->item('s3_access_key'),
                    'secret' => $this->config->item('s3_secret_key')
                ],
            ]);
    

    add Scheme to http if your protocol is Http

    0 讨论(0)
  • 2020-12-15 17:44

    For those using WampServer, open the php.ini file then scroll down to the bottom and add the following:

    curl.cainfo = "C:\wamp\bin\php\php7.2.3\cacert.pem"

    Make sure you have the cacert.pem file in the folder of the current php version you are using. In my case, I have it in the php7.2.3 folder.

    0 讨论(0)
提交回复
热议问题