Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Database Sessions setup and configuration question
  • I'm unable to get sessions using database configured.
    I have created the db file "sessions'.
    The only config setting I find is in app/config/session.php
    The driver default 'cookie' which I have changed to 'db', and the driver specific settings are:
      // specific configuration settings for database based sessions
      'db' => array(
      'cookie_name'    => 'fueldid', // name of the session cookie for database based sessions
      'database'           => 'fuel_test', // null, // name of the database name (as configured in config/db.php)
      'table'                   => 'sessions',  // name of the sessions table
      'gc_probability'   => 5 // probability % (between 0 and 100) for garbage collection
             ),
    
    What am I missing here?
  • Looks ok. Do you have a configured database entry in your config/<environment>/db.php called 'fuel_test'?
  • Yes, the application is working, full database, but using the default session configuration. I need to pass more information via the session and want to try the db approach.
    My first idea was that I didn't have the configuration correctly set up. I'll do some more testing and see if I can find any anomalies.
    thanks
  • If you specify a database name in your session config, it will open a separate connection to that database. If you leave it at 'null', it will look for the session table in the current database. In this case you have configured a separate database, which must exist in your db config.
  • Harro, thanks that was the problem. Set the db name to null in app/config/session.php and I have session records in my db file,
    thanks.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion