Laravel: file_put_contents() permission denied — correct storage/framework/cache permissions? Laravel: file_put_contents() permission denied — correct storage/framework/cache permissions? laravel laravel

Laravel: file_put_contents() permission denied — correct storage/framework/cache permissions?


I cleared the cache completely using sudo php artisan cache:clear. Afterwards, the problem never occurred.

Opposed to Ismoil's answer: never make the Laravel storage folder 777. It poses a security risk.


1) If you take a look at your cache.php config file you'll see that for the file driver the storage/framework/cache/data folder is set for writing:

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

That means that the permissions for that folder must be properly set so that the web server user can successfully write to that folder.

2) or you can just running this command for me it solved my problem

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