krishantalwar's avatar

what is the solution for this error in laravel " failed to open stream: No such file or directory > {"exception":"[object] (ErrorException(code: 0):

I am having the below issue

local.ERROR: file_put_contents(/var/www/html/qa/storage/framework/cache/data/b0/84/b084ee2a4f36d3d49c41d8afc21153cf9ef1903e): failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): file_put_contents(/var/www/html/qa/storage/framework/cache/data/b0/84/b084ee2a4f36d3d49c41d8afc21153cf9ef1903e): failed to open stream: No such file or directory at /var/www/html/qa/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:135) [stacktrace]

Tried following solutions php artisan config:cache , php artisan config:clear , php artisan optimize

composer dump-autoload composer install composer update

I also changed storage folder permission sudo chmod -R 777 storage sudo chmod -R 777 storage/*

shared permission between users and group

sudo chown -R $USER:apache storage sudo chown -R $USER:ec2-user storage

but nothing worked out, still I am getting same error Random files which are created in /storage/framework/cache/data are not having same permissions as storage folder. Can someone suggest a solution for this.

0 likes
4 replies
Nihir's avatar

I followed these steps, and it worked for me. Can you please try?

1 . Delete the vendor folder

2 . reinstall the composer / or update the composer dependencies

composer install

or

composer update

3 . make sure you clear the configuration cache. Or you can remove the cache

php artisan optimize:clear

or

PHP artisan optimize

This worked for me hope that you make sense of it and solve your issue.

thinkverse's avatar

You have already asked this question ~7 minutes ago, please don't repost the same question again and instead wait for your original question to be answered.

1 like
Snapey's avatar

This sort of issue can be caused by running artisan commands as your user which then creates cache file entries in your name, not the web server

You might be able to get around this be making your account in the webserver group and the webserver in your group so that the files are group writable?

1 like
krishantalwar's avatar
krishantalwar
OP
Best Answer
Level 1

i find the solution. i just add 'permission' => 0764,

i just change in cache.php file

'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), 'permission' => 764, ],

and also in logging.php

'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', 'permission' => 0764, ],

'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.log'),
    'level' => 'debug',
    'days' => 14,
    'permission' => 0764,
],

Please or to participate in this conversation.