Welcome Guest, Not a member yet? Register   Sign In
Database session - No database selected
#1

I was going to ask this question but fortunately found the answer by digging into the session handler file.

The main issue is that the documentation doesn't mention yet about this property in the App.php

Code:
public $sessionDBGroup

As in my case, in the config/Database.php - I have two groups "development" and "production" i.e. no "default" group because I had set $defaultGroup = ENVIRONMENT; . This created issue for me as \CodeIgniter\Session\Handlers\DatabaseHandler file was looking for database name in the "default" group.

Code:
$this->DBGroup = ! empty($config->sessionDBGroup) ? $config->sessionDBGroup : 'default';

If you happen to have the same issue, then all you need to do is that in you App.php just add public $sessionDBGroup = ENVIRONMENT; or name of whatever database group you are using.

Hope that helps anyone having similar issue.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB