I have a project on Laravel 5 and I work with it at the office and at home too. It works fine, but recently at home it stopped working. Laravel show me two ErrorException
The best way to solve this problem is, go to directory laravel/bootstrap/cache
and delete all files from cache.
To do this, run the following Artisan commands on your command line
1. php artisan config:clear
2. php artisan cache:clear
3. php artisan config:cache
In your panel or server, you can execute commands by adding the following to your routes:
Route::get('/clear-cache', function() {
$run = Artisan::call('config:clear');
$run = Artisan::call('cache:clear');
$run = Artisan::call('config:cache');
return 'FINISHED';
});
And then call the www.yourdomain.com/clear-cache
route from your browser.
If you are running laravel inside docker then access its filesystem
$ docker exec -it name-of-laravel-container /bin/bash
Next navigate to your laravel projects root directory. Make sure that you have inside storage/framework folder:
And they should be both readable and writable.
This type of issue generally occurs while migrating one server to another, one folder to another. Laravel keeps the cache and configuration (file name ) when the folder is different then this problem occurs.
Solution Run Following command:
php artisan config:cache
https://laravel.com/docs/5.6/configuration#configuration-caching
Clearing the contents of storage/framework/cache
did the trick for me. Nothing else worked...
I solved this problem via creating storage\framework\sessions
folder.
This is a silly mistake, and a different answer compared to the others, but I'll add it because it happened to me.
If you use WSL (linux bash on windows) to manage your laravel application, while using your windows apache to run your server, then running any caching commands in the wsl will store the linux path rather than the windows path to the sessions and other folders.
Simply run the cache clearing commands in the powershell, rather than in WSL.
$ php artisan optimize
Was enough for me.