I am getting the following error from Laravel5 upon rendering any page:
ErrorException in Filesystem.php line 74:
file_put_contents(/fdcc73e2e72031a510ae8f921ce1d22d): failed to open stream: Permission denied
my cache config is as follows:
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc'
],
'array' => [
'driver' => 'array'
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path().'/framework/cache',
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
];
Interestingly enough if I change the default to array or any of the other options it still tries to write the cache file to root folder and fails every time.
Has anyone else encountered this?
Laravel provides a unified API for various caching systems. The cache configuration is located at app/config/cache. php . In this file you may specify which cache driver you would like used by default throughout your application.
When a request is executed that renders a view, Laravel will compile the view if a pre-compiled view does not already exist (or if the view has been modified more recently than the compiled view). View caching pre-compiles all of the views utilized by your application.
To clear your application cache, you may run the following Artisan command: $ php artisan cache:clear Application cache cleared! This will clear all the cache data in storage which are typically stored in /storage/framework/cache/data/ .
See if 'storage/framework/views' exists. If you add it and you still have problems. Make sure it is writeable (775, 77, etc...)
In my case, error happened because I deployed to my production server via github, but the contents of storage were not tracked by git. I fixed this by making sure that the .gitignore files in each of the directories inside /storage were committed to the repo.
Notes: Usually those weird filenames have something to do with the Blade templates. I don't think it's actually trying to store the cache file in root.
My error was similar: "ErrorException in Filesystem.php line 81: file_put_contents(/f946048111f1176619e22f5127724e37): failed to open stream: Permission denied"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With