I have two Magento stores and a huge amount of session files are being stored (file system). This is causing my server to crash as it's running out of space.

Can anyone suggest a modification, so that I can for example, remove all session files older than 7 days?

I understand this may be possible with htaccess?


There are lot reasons,

In my experience,i have seen that most of case the 3rd party module,will created the issue.So disabled the extensions, and check that session files no.

| improve this answer | |
  • Is there a way to command Magento to stop storing session files for so long Amit? Mine go back to the day of first install. – YorkieMagento Dec 8 '16 at 16:07
  • please do at staging system – Amit Bera Dec 8 '16 at 16:14

Problem is, garbage collector unable to remove your session. So you need to define lifetime for them.

Add following code into .htaccess file OR you can change value directly into php.ini file

php_value session.cookie_lifetime 86400
php_value session.gc_maxlifetime 86400
php_flag session.cookie_httponly on
| improve this answer | |

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.