Laravel 7 Please Provide a Valid Cache Path

Laravel 6 , Laravel , Laravel 7

Nicesnippets

339

10-08-2020


Hi Guys,

In this blog , I will show you how to solution Please Provide a Valid Cache PathError in laravel 7.some error occurs on deploying laravel projects on webservers. So don’t worry about that this error “please provide a valid cache path laravel“.

The reason for occurring this error “please provide a valid cache path laravel” error occurs. Because inside your laravel project, does not have some directories/folders. The directories and folders are the following:

->YourProjectFolder/storage/framework/

->sessions

->views

->cache

This blog will provide you 3 solutions to fix this “please provide a valid cache path laravel” on your server or virtual host.

Solution No – 1

In the first solution, you can create a framework folder inside your laravel-project-name/storage/ directory by using the following command:

cd storage/

mkdir -p framework/{sessions,views,cache}

Then set permissions to the directory. To allow Laravel to write data in the above-created directory. So run the following command on your command prompt:

cd storage/

chmod -R 775 framework

chown -R www-data:www-data framework

Solution No – 2

In the solution number 2, You can create mutually directories inside your laravel project folder.

So, Navigate to your project root directory and open Storage folder.

Then, Create framework directory/folder inside the storage folder.

After that, create the following directories inside the framework folder.

->sessions

->views

->cache

cache/data:- Inside cache folder, create a new directory/folder named data.

Finally, open your terminal and run the following command to clear all the cache:

php artisan cache:clear

Solution No – 3

In this solution number 3, open your terminal and run the following commands:

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

sudo chmod -R 777 storage

It will help you..