2
I am trying to send a file to the S3 server of Amazon, followed the documentation of Laravel 5.4 that talks about Filesystems. But it returns the error:
Error executing "ListObjects" on "https://s3.amazonaws.com/comercio-urbano?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)
Routes
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index');
Route::get('/test', 'TesteController@teste');
Controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class TesteController extends Controller
{
public function teste()
{
echo '123';
$s3 = Storage::disk('s3');
$s3->put('myfile.txt', 'Teste', 'public');
}
}
Filesystems
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
.ENV
AWS_KEY=AKIAJKD62YA24W4T5QUA
AWS_SECRET=tbGRprt8vVXp5leUp5S65xVak0nZrLBZPPdO+fbC
AWS_REGION=us-east-1
AWS_BUCKET=comercio-urbano
Any suggestions?
These are not your real keys right (AWS_KEY, AWS_SECRET)? If they are, I suggest removing as some malicious user may use them.
– Murillo Goulart
It’s not the real one, I changed a few letters and numbers.
– Vinícius
From what I saw of the indicated error:
unable to get local issuer certificate
problems in the certificate, are you using ssl location to send the file? Here are the error codes shown in the Curl link:https://curl.haxx.se/libcurl/c/libcurl-errors.html
– Evert
@Evert Yes, that was the mistake right there, I took the codes from localhost and it worked. Thank you!
– Vinícius
Since you decided to post as an answer to help others.
– Evert
But you used on the server with ssl?
– Evert
Uhum, I didn’t even have to change anything in the code. @Evert
– Vinícius