krishantalwar's avatar

file_put_contents(/storage/framework/cache/data/a9/89/a989827f8122ff83b52070e6b7daa7041016de7d):failed to open stream:No such file or directory [closed]

file_put_contents(/var/www/html/qa/storage/framework/cache/data/a9/89/a989827f8122ff83b52070e6b7daa7041016de7d): 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/a9/89/a989827f8122ff83b52070e6b7daa7041016de7d): failed to open stream: No such file or directory at /var/www/html/qa/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:135)

i try with this command. but nothing work

php artisan config:cache php artisan config:clear php artisan optimize

composer dump-autoload composer install composer update

i also change storgae folder permisrion

sudo chmod -R 777 storage sudo chmod -R 777 storage/*

we also tried to share permission between users and group

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

0 likes
7 replies
Nihir's avatar

To do this, run the following Artisan commands on your command line php arPHPan cache:clear php arPHPan config:cache

Then assign the permissions to the folder storage/framework/cache and Go to directory laravel/bootstrap/cache and delete config.php

And try one more thing, which is to remove the vendor folder and try to reinstall dependencies

This worked for me hope it worked for you.

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' => 0764, ],

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,
    ],
1 like
Snapey's avatar

data should not be executable. Should be 664 to be group writable

BandiCsongor's avatar

@Snapey I had to set permissions to 775 (drwxrwxr-x) for the file driver in the cache.php config file in order to avoid generating an error. Before that, the folders were created with 755 (drwxr-xr-x).

To reproduce: Execute jobs using Supervisor with a user different from the default apache user. Within these jobs, read and write data in the cache, and also try to read and write to the same cache within an HTTP request.

Snapey's avatar

@BandiCsongor I don't want to get into it on someone elses question, but it is to do with OWNERSHIP.

You cannot talk about whether certain permissions are correct without also knowing who owns any existing files.

Please or to participate in this conversation.