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

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:

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:

And the results are:

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?

CI 4.1.1
env(...) string (44) "CodeIgniter\Session\Handlers\DatabaseHandler"
⧉Called from .../app/Controllers/Home.php:12 [d()]
config(...)->sessionDriver string (44) "CodeIgniter\Session\Handlers\DatabaseHandler"
⧉Called from .../app/Controllers/Home.php:13 [d()]

I am using 4.1.1 too, and yet behavior is different. My question is how can i troubleshoot this?

Replace your configs with the default configs. Maybe some setting affects this behavior.

Just a comment - I have had "strange" problems with env lately - https://github.com/codeigniter4/CodeIgni...ssues/3992
I have stopped relying on the magic .env for many things and replaced with standard php getenv() in this way:

$this->default['password'] = getenv('CONFIG_RDS_PASSWORD', true);

I still set CONFIG_RDS_PASSWORD in my .env.

Theme © iAndrew 2016 - Forum software by © MyBB