Search code examples
phpmysqldatabasesessionmembership

Why store session data in an application database?


Unless it has to do specifically with the application, why keep track of the session in a database? I mean, most session data has to do with users with membership, so if the user is logged in, you can easily keep track of them via their member id. So why keep session data in the database?


Solution

  • Not everyone runs with just a single server, and file-based sessions are difficult to share between multiple servers reliably. Putting the session into a database takes care of most of those sharing problems.