Please Provide a Valid Cache Path in Laravel

Today, I have cloned an existing Laravel application and composer update, but I have getting en error: Please provide a valid cache path. I have more debugging then I found that the storage/framework directory is missing from deployment. Because the .gitignore file has an entry of storage/framework directory to prevent them from adding code to the git repository and this is normal.

Solution 1:

To solve this issue, you have to create “framework” folder inside the storage directory. Inside the “framework” directory create 3 more directories as “sessions, views and cache” as below:

/path/to/laravel/storage/framework/

  • sessions
  • views
  • cache
cd storage/
mkdir -p framework/{sessions,views,cache}

You also need to set permissions to allow Laravel to write data in this directory.

chmod -R 777 framework
chown -R www-data:www-data framework

Solution 2:

We can create framework folder inside storage then create bellow three directory inside your framework directory and the cache inside a data named folder.

  • sessions
  • views
  • cache/data

After this you need to run clear cache using bellow artisan command:

php artisan cache:clear

Solution 3:

You have need to create storage folder inside “framework” folder using bellow command to create session, view and cache in data:

sudo mkdir storage/framework
sudo mkdir storage/framework/sessions
sudo mkdir storage/framework/views
sudo mkdir storage/framework/cache
sudo mkdir storage/framework/cache/data

Run successfully above command then after give the permission to storage folder using bellow command.

sudo chmod -R 777 storage

I hope these solution work for you.

Leave a Comment