php – Laravel with SQLite doesn't keep Auth data-ThrowExceptions

Exception or error:

I have project in Laravel 6 with MySQL database and its working fine. My client wants to use SQLite instead of MySQL database.

So i converted my existing database from database.sql to database.sqlite using following online tool
Online database conversion done here :

After that i have configured database.sqlite into .env file and into config/database.php file.

Issue : I am not able to go beyond login page. Every time i try to login it redirects me back to login page.

Debug : I reviewed that if I remove Authentication function then i am able to access controller which comes after login.

If I do comment to this line $this->middleware(‘auth’); following function It starts working.

public function __construct()
    // $this->middleware('auth');

Conclusion : I found that I am not getting any value for $user = Auth::user();

So I think that session is not getting generated and stored correctly with SQLite database

Notes :

  • I have exported existing database using phpmyadmin and removed all
    unnecessary comments from database.sql file.
  • I converted database.sql file online using this tool
  • As per my investigation Auth is not getting generated and stored.
  • I am using default laravel Auth, I generated that using laravel terminal command.
  • This setup works fine if I configure project with MySql database.
  • SQLite database configure Path is correct. I found error of not proper path while configuring it and i solved that.
  • I have already tested using this commands. : php artisan cache:clear — php artisan route:cache — php artisan config:cache — php artisan view:clear

Any help are appreciated. Thanks in advance.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *