Aleksey Dorogov freelance software engineer
← All writing Laravel / PHP

HotFix: Laravel - Failed to open stream: Permission denied

Aug 2025 1 min read Aleksey Dorogov

Sometimes it happens :) if you stumbled with error about file_get_contents and permission denied - failed to open the stream in Laravel 5, try these commands, and everything should be fixed. Try this code if the error occurs on the localhost and dev server.

php artisan cache:clear
chmod -R 777 storage/
composer dump-autoload

**Update! **

I forgot to say that we should avoid 777 chmod on production, if you get this error on your production live stage - try to set 755 instead.

Sitting on a version of this problem right now? I'd rather look at it than guess.

Email me
Site down? Message me now Live chat · usually reply in minutes