Home / Snippets / How to Fix "Please Provide a Valid Cache Path" error in Laravel
How to Fix "Please Provide a Valid Cache Path" error in Laravel cover

How to Fix "Please Provide a Valid Cache Path" error in Laravel


2 years ago


In this snippet, you'll learn how to fix "Please Provide a Valid Cache Path" in Laravel and this is a common error when you are manually setting up to deploy your Laravel application to VPS/cloud.

The Cause of Error
This error it's caused by the missing "storage/framework" directory and its respective sub directories. Because of this, the application will throw an error saying "Please provide a valid cache path".

The Fix to the Error
The fix to this error is to have the following directories inside the "storage" folder.

The path is as follows.

Step 1 - Create Missing Directory
To create the missing directory you can SSH to the server and create the storage with the command line. Do note that it's assumed you are in the root directory of your Laravel application.
cd storage
mkdir -p framework/{sessions,views,cache}

The command below will create the 3 sub-directory "session", "views" and "cache" inside the framework directory.

Step 2 - Set Directory Permission
Finally set the directory permission to allow write to the directory.
chmod -R 777 framework
chown -R www-data:www-data framework

Step 3 - Run Link Storage Command 
The final step is to run "php artisan storage:link" command and this will link your "storage" directory with the "/public/storage" directory.
php artisan storage:link

You might also need to clear the cache in Laravel to clean up any existing cache.
notion avatar


Week-end developer currently experimenting with web, mobile, and all things programming.






Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this