@nicopin I use S3 in pretty much all my projects and never had an issue with it.
What version of the Flysystem S3 adapter do you have installed? And what configuration variables do you have in your .env file?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi I'm having trouble when i use Storage::disk('s3') in Laravel9.
The situation is that If S3 is to be used as storage, the Storage facade is currently not functional because it cannot run properly with only the configuration in the documentation. I have confirmed that communication is possible when using the S3 client directly.
The Storage::disk('s3')->directories() is not working. It returns errors like below.
Aws\S3\Exception\S3Exception with message 'Error executing "ListObjectsV2" on "https://aws-bucket"; AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target host name 'aws-bucket-name' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for aws-bucket-url
I searched and I've found that it may have to do with openssl. So I configured openssl and setup cacert.pem from mozilla. Then I tried to use S3Client and AwsS3V3Adapter directory. And below code worked.
$client = new S3Client([
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY')
],
'region' => env('AWS_DEFAULT_REGION'),
'http' => ['verify' => '/usr/local/etc/ssl/cacert.pem'], // this configuration was needed on local env.
'version' => 'latest',
]);
$adapter = new AwsS3V3Adapter($client, 's3-bucket-name');
$filesystem = new Filesystem($adapter);
try {
$filesystem->write('sample2.txt', 'content');
} catch (FilesystemException $e) {
dd($e);
}
Does anyone have ideas to make Storage facade work properly? Thank you.
@nicopin Remove the AWS_ENDPOINT and AWS_URL variables. They’re not needed. The Flysystem driver can build proper S3 object URLs without those.
Please or to participate in this conversation.