0

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

Community
  • 1
  • 1
user3538235
  • 1,991
  • 6
  • 27
  • 55

1 Answers1

0

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

user3538235
  • 1,991
  • 6
  • 27
  • 55