1

Magento gives you two options to store session data, in the database or the file system.

We like to keep the session information for a few days to be able to follow up abandoned carts and give the customer the ability to see his cart if he comes back the other day.

Storing the sessions in the database everything works fine, but the database is getting quite large.

When storing the session data in the file system in var/session this folder is cleared every few hours. Sometimes all files will be deleted after 2 hours, sometimes after 6 and somtetimes after 11 hours. To me it looks like some cron job or automation is doing this. I was thinking it might be some configuration in the php.ini like sess.gc_maxlifetime, but here is what makes me think it is one of our extensions doing this:

Having two shops, one is our live shop connected to our ERP by a special extension and the second one is an identical clone, but not connected to our ERP. All other parameters (php, .htaccess, admin backend settings etc.) are the same. On the live shop the directoy var/session will be cleared and on the second shop the files will be kept forever.

Running Magento 1.9.2.1, but having this issue since 1.4.

Any idea what might lead to the deleted files?

2

Check if a cronjob is deleting files in var/session.

Also check your php.ini garbage collection settings

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.