In this tutorial you will learn about the Laravel 7 Please Provide a Valid Cache Path and its application with practical example.
In this Laravel 7 Please Provide a Valid Cache Path tutorial, I’ll show you how to fix the issue Laravel 7 Please Provide a Valid Cache Path.
Laravel 7 Please Provide a Valid Cache Path
When deploying a laravel project on the webserver or virtual host. You conmanly face issue that “please provide a valid cache path laravel”. This error “please provide a valid cache path laravel” mainly occurs, because your laravel project does not have some required directories/folders. The directories and folders are the following:
storage/framework/
sessions
views
cache
In this article I’ll share 3 different solutions to fix this “please provide a valid cache path laravel” on your server or virtual host.
Solution 1 : How to fix laravel “Please Provide a Valid Cache Path”
In this soluction you have to create a framework folder inside your laravel-project-name/storage/ directory by using the following command:
1 2 |
cd storage/ mkdir -p framework/{sessions,views,cache} |
Now you have to 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:
1 2 3 |
cd storage/ chmod -R 775 framework chown -R www-data:www-data framework |
Solution 2 : Laravel “Please Provide a Valid Cache Path” error
In this method you have to create manually directories inside your laravel project folder. Go to your project root directory and open Storage folder and Create framework directory/folder inside the storage folder. Once you have create following directories inside the framework folder.
- sessions
- views
- cache
- cache/data:- Inside cache folder, create a new directory/folder named data.
Open your terminal and run the following command to clear all the cache:
1 |
php artisan cache:clear |
Solution 3 : “Please Provide a Valid Cache Path” error in laravel
In this method you have to open your terminal and run the following commands:
1 2 3 4 5 6 7 |
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 |