Answer by Mitchell McKenna for Which session library should I use with CodeIgniter?

September 8 2010, 5:11am

CI sessions offers some extra functionality; such as auto regenerating the session id every given amount of time (for security), IP address tracking, and flashdata (session data that's cleared after it's read once).

CI's session mechanism stores all the data in a cookie. PHP's native session mechanism is stored server side. Each have it's advantages/disadvantages. Cookies can only hold 4KB of data, so if your storing large amounts of data in session PHP native sessions might be better.

If you decide to you want to use native PHP sessions use: Session Hybrid (CI 1.7.2)

Session Hybrid uses native PHP sessions, can store session data in the default CI db, is a drop-in replacement for CI’s session class, and only requires one file to be rewritten.

[* If using a CI version before 1.7.0 try PHPSession and Native Session]

Side note: If you choose to stay with CI's sessions, for additional security you can store sessions in a database and encrypt the cookies (see Session Preferences).