Sunday, December 29, 2024
Google search engine
HomeLanguagesLaravel 10/9/8 Please Provide a Valid Cache Path

Laravel 10/9/8 Please Provide a Valid Cache Path

If you are deploying your laravel project from localhost webserver to virtual host. At that time, you saw “please provide a valid cache path laravel”.

You can see the error in the below picture:

Please Provide a Valid Cache Path laravel

Sometimes, some error occurs on deploying laravel projects on web servers. So don’t worry about that this error “please provide a valid cache path laravel” or “failed to clear cache. make sure you have the appropriate permissions”, or “failed to clear cache. make sure you have the appropriate permissions.”.

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 post will provide you 3 solutions to fix this “please provide a valid cache path laravel” on your localhost or virtual host server.

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 

If the cache is not cleared yet. Then go to bootstrap/cache directory. And delete all files and sub directories inside the bootstrap/cache directory.

Or, We can execute the following on the terminal instead of manually deleting the file:

cd bootstrap/cache/
rm -rf *.php

Conclusion

In please provide a valid cache path laravel post. You have learned how to remove “please provide a valid cache path laravel”.

Recommended Laravel Posts

Recommended:-Laravel Try Catch

RELATED ARTICLES

Most Popular

Recent Comments