Clearing dead sessions from the database
You may have found that CodeIgniter sometimes does not successfully remove sessions from the sessions table in the database. Unused sessions are instead cleared of their
user_data field, but that the row remains in the sessions table.
I have often had to write specific database queries to clear sessions. I usually put these queries in the
My_Controller class(refer to the Extending your controllers recipe in this chapter); however, I have recently begun to use Hooks to perform this. Then it's always working in the background and I don't need to think about it.
We're going to amend the following file:
/application/config/config.php file ...