Convert file based session into database based session in magento 1.6

Basically magento provides two type of session management.

  1. File based session
  2. Database based session

File based session - At the time of installation, magento ask about which session management technique do you want to use? Normally we choose file based session, without knowing about benefits of this type of session (because it's by default selected by mangento).

File based session are simple, stable and durable. Simple because do not need any kind of setup. Stable because storing session in file. Durable because if system restart you will not lose your data.

Database based session - This is second type of session management technique. Normally we did not choose this because we forgot to select "Database session" form drop down list at the time of magento installation.

In Database session, session data store in Database. One of the key benefit of storing session in database is easy sharing of session data. Database provides this capability quite easily.

It also gives stability and durability.

A site with lots of products and session gives extra load on database.

Magento stores session type information in app/etc/local.xml. session_save tag tells about the type of session.

For file based session -

  <session_save><![CDATA[files]]></session_save>

For database based session -

  <session_save><![CDATA[db]]></session_save>

Any time you can change file based session in to database based session or vice versa by just changing in session_save tag.

Created At: 27 March, 2024

Views: 3,275



Social Sharing
Search