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

dixitchopra's avatar

Cache - failed to open stream

I am getting this error again and again. I have already set /var/www/laravel/storage to -R 777.

production.ERROR: exception 'ErrorException' with message 'file_put_contents(/var/www/laravel/storage/framework/cache/4f/64/4f64b5b0caaa488e20ab4995e): failed to open stream: No such file or directory' in /var/www/booking/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:81

0 likes
5 replies
mstnorris's avatar

Are you using Laravel 5? Have you run composer dump-autoload -o after?

Maybe try composer update too.

andy's avatar

I normally do as @mstnorris suggested. However, I do that after I erase my cache manually.

mstnorris's avatar

Yes manually delete the files too.

You can also run the command:

php artisan cache:clear
2 likes
andy's avatar

LOL, I need to change my server settings since that command doesn't do anything.

sudo rm -R storage/framework/cache/*
sudo rm -R storage/framework/views/*

If you do the sessions folder you will get logged out ;-)

3 likes

Please or to participate in this conversation.