codeigniter - Should I use Database Sessions or Native PHP File Sessions? -


i've moved on own mvc framework community supported 1 (codeigniter). i'm converting sessions on codeigniter functions , noticing they, default, store session data in encrypted cookie. alternative offer database sessions not server-side file sessions native php library.

now on site, building secure backend panel encrypted cookie doesn't seem smart option don't particually want have connect database unnecessarily it's not fast (shared hosting).

i'm wondering reasoning behind them not supporting native sessions , whether database sessions or server-side file sessions regarded better option.

thanks.

basically, store session's data, people use 1 of 3 solutions :

  • files (the default)
  • database
  • memcached

files used, it's default -- , works fine in cases -- there's @ least 1 situation in doesn't work : when have several servers, , users load-balanced on (i.e. when 1 user not on same server).

in kind of situation, having central/shared place store sessions necessary -- , databases fit description ; , easy setup, -- , php applications work database.

and databases don't scale well, writes, use, instead, memcached : mecanism stores data in ram (faster), accross many servers want/need (scales well).


solution should use ?

well, in of situations ?

  • files ok, @ least long 1 user on same server
  • if need database application, can store sessions in database : no need additionnal setup (for example, drupal this, default).
  • memcached needs more setup, best solution if have heavy traffic...

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -