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

使用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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作