Welcome Guest, Not a member yet? Register   Sign In
.env Settings ignored in session driver
#1

Hey guys i am having a very strange issue. 

My Config/App.php file is the default one, where the session driver is set as FileHandler. 

I would like to use a database for this, so i change my .env settings to:

Code:
app.sessionDriver = CodeIgniter\Session\Handlers\DatabaseHandler
app.sessionCookieName = sess
app.sessionSavePath = ci_sessions
app.sessionMatchIP = false
app.sessionTimeToUpdate = 300
app.sessionRegenerateDestroy = false

Unfortunately the application still uses the FileHandler, and not the DatabaseHandler

Things i have checked:
- the ci_sessions table is created via the migration;
- if i change the settings in Config/App.php to DatabaseHandler it seems to work (i can see data written to the ci_sessions table)
- i used this to debug my settings:
PHP Code:
d(env('app.sessionDriver'));
d(config('App')->sessionDriver); 

And the results are:

Code:
env(...) string (44) "CodeIgniter\Session\Handlers\DatabaseHandler"
⧉Called from .../app/Controllers/Dashboard.php:18 [d()]
config(...)->sessionDriver string (40) "CodeIgniter\Session\Handlers\FileHandler"
⧉Called from .../app/Controllers/Dashboard.php:19 [dd()]


So it seems to me that my settings are in place. 

What am i missing where? Isn't .env always overriding the settings in Config/App.php?
Reply


Messages In This Thread
.env Settings ignored in session driver - by korgoth - 02-22-2021, 04:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB