Felix
Felix

Reputation: 2661

AWL SSL error in Laravel : unable to get local issuer certificate

I'm currently setting up amazon s3 on my laravel setup (first time doing anything with AWS), and I've run into a bit of a snag. For reference, I'm using XAMPP v.3.2.2 and PHP 7.0.5. Maybe someone can tell me where I went wrong.

First, I added these to my composer.json file:

"require": {
    "graham-campbell/flysystem": "^3.0",
    "league/flysystem-aws-s3-v3": "^1.0"
},

and ran a composer update.

Next, I added this to my filesystems.php file:

's3' => [
    'driver' => 's3',
    'key'    => 'A--------edited out for stackoverflow-------WA',
    'secret' => 'h-------------edited out for stackoverflow-------------B',
    'region' => 'us-east-1',
    'bucket' => 'commendmeus',
],

and finally I tried doing a test to make sure everything worked. In my routes file I added:

use Illuminate\Support\Facades\Storage;
get('test', function () {
        echo 123;
        $s3 = Storage::disk('s3');
        $s3->put('myfile.txt', 'test file', 'public');
});

Unfortunately, I ran into an error:

S3Exception in WrappedHttpHandler.php line 192: Error executing "ListObjects" on "https://s3.amazonaws.com/commendmeus?prefix=myfile.txt%2F&max-keys=1&encoding-type=url"; 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)

Here is a screenshot for reference:

enter image description here

I know nothing of SSL, and while I've seen errors similar to mine on stackoverflow, it might as well be like reading chinese to me. Could anyone help me out with what the proper course of action would be?

Upvotes: 3

Views: 3331

Answers (2)

John Hanley
John Hanley

Reputation: 81454

This problem is usually caused by cacert.pem missing from your PHP setup.

1) Download cacert.pem from https://curl.haxx.se/ca/cacert.pem

2) Copy cacert.pem to your PHP directory (or any location).

3) Modify your php.ini to include lines similar to these. Note: the path must be absolute and correct for your system (Windows use C:\path\cacert.pem for example):

curl.cainfo=/path/cacert.pem

openssl.cafile=/path/cacert.pem

Upvotes: 6

Evis
Evis

Reputation: 561

Please avoid using localhost, try to name your local domain using, hostname, and get a certificate (ssl) and should work just fine:

Example: https://local.dev

Upvotes: -2

Related Questions