user image

Joseph Morgan
Published in : 2022-01-08

Failed to open stream: Permission denied Local.php on line 157


Failed to open stream: Permission denied in file /var/www/example/vendor/league/flysystem/src/Adapter/Local.php on line 157
I am facing this error above when i try to save an image in the Laravel storage,

the entire error is 

ErrorException: fopen(/var/www/example/storage/app/public/images/wuIi6l6oB2D6BBTc3JiFSt4HbX0is3cYJ4BHWj76.png): Failed to open stream: Permission denied in file /var/www/example/vendor/league/flysystem/src/Adapter/Local.php on line 157

#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /var/www/example/vendor/league/flysystem/src/Adapter/Local.php(157): fopen()
#2 /var/www/example/vendor/league/flysystem/src/Filesystem.php(123): League\Flysystem\Adapter\Local->writeStream()
#3 /var/www/example/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(260): League\Flysystem\Filesystem->putStream()
#4 /var/www/example/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(296): Illuminate\Filesystem\FilesystemAdapter->put()
#5 /var/www/example/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(276): Illuminate\Filesystem\FilesystemAdapter->putFileAs()
#6 /var/www/example/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(252): Illuminate\Filesystem\FilesystemAdapter->putFile()
#7 /var/www/example/app/Http/Controllers/forum_controller.php(537): Illuminate\Filesystem\FilesystemAdapter->put()

Please let me know how can I solve this bug?


Jo Micheal Date : 2022-01-08

Best answers


Best answers


You can give Permission to the storage folder using this command 

sudo chmod -R 0777 storage/


sudo chmod -R 0755 storage/

then clear your cache & configuration using 

php artisan config:cache

php artisan config:clear

let me know if you need something else.

Joseph Morgan Date : 2022-01-08

it works !!! 

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Laravel Network is unreachable stream_socket_client 587
Publish date: 2022-02-16 | Comments: 4
laravel installation error with composer install
Publish date: 2022-02-23 | Comments: 2
How can i pass data from blade template to vue component?
Publish date: 2022-02-11 | Comments: 1
tymon/jwt-auth 0.5.12 requires illuminate/support ~5.0
Publish date: 2022-02-18 | Comments: 2
[solved] Class "App\Exceptions\Client" not found
Publish date: 2022-02-09 | Comments: 2