dongshi4078
2015-09-08 07:53
浏览 110
已采纳

使用Amazon S3 PHP sdk时设置证书验证位置时出错

Here is the code to implement Amazon S3 delete object

    require_once(APPPATH . 'libraries/aws.phar');

    $s3 = S3Client::factory(array(
                'key' => S3_KEY,
                'secret' => S3_SECRET
    ));

    $s3->deleteMatchingObjects(S3_BUCKET, "abc.mp4");

The error message is:

Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 77: error setting certificate verify locations: CAfile: /tmp/guzzle-cacert.pem CApath: none [url] https://testdomain.s3.amazonaws.com?prefix=abc.mp4' in phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php:359 Stack trace: #0 phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php(292): Guzzle\Http\Curl\CurlMulti->isCurlException(Object(Guzzle\Http\Message\Request), Object(Guzzle\Http\Curl\CurlHandle), Array) #1 phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php(257): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\Request), Object(Guzzle\Http\Curl\CurlHandle), Array) #2 phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php(240): Guzzle\Http\Curl\CurlMulti->processMessages() #3 phar:///home/in001/public_html/yo in phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Aws/Common/Client/AbstractClient.php on line 258

I have followed the example here:

Delete object or bucket in Amazon S3?

and logged all parameter is correct, any idea of how to fix it?

Thanks for helping

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongshendi3599 2015-09-09 07:02
    已采纳

    Instead of using the .phar , download the zip file

    https://github.com/aws/aws-sdk-php/releases

    and require like this:

    require_once(APPPATH . 'libraries/aws/aws-autoloader.php');
    

    fixed the problem

    点赞 打赏 评论

相关推荐 更多相似问题