Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storage::get( ) using Amazon S3 returns false

Combining both Intervention Image and Amazon S3, I'd like to be able to pull a file from S3 and then use Image to do some cropping. This is what I have so far, why does Storage::get() return false?

$path = 'uploads/pics/123.jpeg';

$exists = Storage::disk('s3')->exists($path); // returns true

$image = Storage::disk('s3')->get($path);     // returns false

From the S3 side of things, the bucket permissions are set to 'Everyone', the Storage::getVisibility() returns public... I'm not sure why I can't load the image as if it were a local image.

like image 963
dargue3 Avatar asked Nov 16 '16 21:11

dargue3


1 Answers

After digger deeper into the code I found this message

"Error executing "GetObject" on "file"; AWS HTTP error: file_exists(): open_basedir restriction in effect. File(/etc/pki/tls/certs/ca-bundle.crt) is not within the allowed path(s): (paths)"

First it seems that my server don't have this file, but it have! The file is located in another folder.

/etc/ssl/certs/ca-certificates.crt

So, to solve my problem in Ubuntu I have to create this folder /etc/pki/tls/certs and after that, symlink to the correct file:

cd /etc/pki/tls/certs;
sudo ln -s /etc/ssl/certs/ca-certificates.crt ca-bundle.crt;

Edit your php.ini and add /etc/pki/tls/certs/ca-bundle.crt to the open_basedir configuration.

Restart your php server!

For me it solves the problem, hope it helps!

like image 173
Jonathan Martins Avatar answered Sep 20 '22 23:09

Jonathan Martins