Joseph Morgan
8 Jan 2022
Laravel
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
8 Jan 2022
Best Answer
You can give Permission to the storage folder using this command
sudo chmod -R 0777 storage/
or
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
8 Jan 2022
it works !!!
Thanks.
© 2024 Copyrights reserved for web-brackets.com