Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bbansal15's avatar

Storage issue on s3

Hi I am using Laravel 5.1 and i am trying to get the storage path,

Storage::disk(env('FILE_SYSTEM'))->getDriver()->getAdapter()->getPathPrefix();

If FILE_SYSTEM = local, then its giving me correct path. but when i deploy the code on aws, where i am using s3 bucket, then replacing the FILE_SYSTEM = s3 is returning null.

I am unable to find out the actual issue. Please help.

Thanks in advance

0 likes
1 reply
Sinnbeck's avatar

Never use env outside if config. It will return null if config is cached

Storage::disk(config('filesystems.system'))->getDriver()->getAdapter()->getPathPrefix()

//and config/filesystems.php
'system' => env('FILE_SYSTEM');

Please or to participate in this conversation.