Magento Convert session from file to Database

By | November 17, 2013

One of the key concept of Magento is the session either customer session OR core session .Magento can be fully customized the way we require.Main concept of session is to store Data and used whenever require.Magento supports the complex and simple way that’s the Magento professional Way

Session can be stored in Magento in two ways

1.File based session
2.Database based session

File based session – Are the session which are stored in files under var/session folder.At the time of installation magento ask where you need to store session and without knowing any thing we just simply select the file system from Drop down.File based session are simple, stable and durable. Simple because do not need any kind of setup.Durable because if system restart you will not lose your data.

Database based session – Are the session which get 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 and Normally we did not choose this because we forgot to select “Database session” form drop down list at the time of magento installation.

It also gives stability and durability.

Now if we want to change the session where to save so simply we need to 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>

so once your clear the cache and refresh the site you will get session saved where you want as per local.xml

hope this will help you

Leave a Reply