15

I'm trying to test in PHP Amazon S3 on my localhost but keep getting the same error:

Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #69; cURL error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.' in C:\wamp\www\mysite\application\libraries\awsphp\lib\requestcore\requestcore.class.php:829 Stack trace: #0 C:\wamp\www\mysite\application\libraries\awsphp\sdk.class.php(1034): RequestCore->send_request() #1 C:\wamp\www\mysite\application\libraries\awsphp\services\sqs.class.php(250): CFRuntime->authenticate('ListQueues', Array) #2 C:\wamp\www\mysite\application\libraries\awsphp\services\sqs.class.php(582): AmazonSQS->authenticate('ListQueues', Array) #3 C:\wamp\www\mysite\application\controllers\uploads.php(33): AmazonSQS->list_queues() #4 [internal function]: Uploads->aw3() #5 C:\wamp\www\mysite\system\core\CodeIgniter.php(359): call_user_func in C:\wamp\www\mysite\application\libraries\awsphp\lib\requestcore\requestcore.class.php on line 829

Test code:

$sqs = new AmazonSQS();
$response = $sqs->list_queues();
var_dump($response->isOK());

I properly installed the AWS SDK to php files and enabled CURL and SSL on me local server. What can I do to make this work? I can't find any help online. I'm using wamp.

CyberJunkie
  • 21,596
  • 59
  • 148
  • 215
  • i have a similar problem http://stackoverflow.com/questions/12253812/aws-s3-batch-upload-from-localhost-php-error but the fix below did not work – t q Sep 04 '12 at 14:56

3 Answers3

54
  1. Get this file and save it to your hard drive. Call it cacert.pem.
  2. Configure curl.cainfo in php.ini with the full path to the file downloaded in step 1.
  3. Restart Apache.

I'll leave it as an exercise for the reader to find out why this fixes it, all the information you need can be found in the links above.

Florian Margaine
  • 58,730
  • 15
  • 91
  • 116
DaveRandom
  • 87,921
  • 11
  • 154
  • 174
  • 3
    Cheers for that! To my understanding I need a valid SSL certificate to connect to the right server. I added `curl.cainfo = "C:/cacert.pem"` at the bottom of my php.ini file and the errors are gone. It also works adding `curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);` and `curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);` but it's not secure – CyberJunkie Aug 11 '12 at 22:49
  • 1
    wow finally found a proper solution after hundreds of useless 'solutions' like `curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);` Thank you! – Inoryy Oct 23 '12 at 17:26
  • 5
    Awesome. Thank you! For me, I was having trouble on WAMP using the AWS SDK (SQS). After reading this post, I copied the cacert.pem file that was included in the AWS SDK (here https://github.com/amazonwebservices/aws-sdk-for-php/tree/master/lib/requestcore) to C:\code\cacert.pem, and then I added this to the bottom of my php.ini: `curl.cainfo = C:\code\cacert.pem` – Ryan Jan 31 '13 at 00:01
  • I would have loved to give more ups , i have been wasting so much time to solve this ! Thanks – soipo Oct 09 '15 at 14:02
  • For me configuring curl.cainfo didn't work but instead the same steps except that the full path should be set to openssl.cafile in the php.ini – isaac.hazan Nov 06 '16 at 17:02
  • 1
    I can confirm this to be a solution for localhost (XAMPP) – GRowing May 29 '17 at 17:24
  • And Devember 2019! – Clive Portman Dec 02 '19 at 16:01
1
  1. Are you running on Windows?
  2. Did you take the time to run the SDK Compatibility Test that comes bundled with the SDK?
Ryan Parman
  • 6,855
  • 1
  • 29
  • 43
0

According to this post you can't work with Amazon AWS on localhost..

CyberJunkie
  • 21,596
  • 59
  • 148
  • 215