Opencart Sessions Not Closing – TMP Drive/DIR Full!
We’ve been using Opencart for a number of large online shop’s recently, its much more scalable and has much cleaner code than other shopping cart packages available.
There are a number of things it does so much better than the rest, stuff like different pricing groups, one page checkout etc.
However, there are a few things it doesn’t do too well – one of which was an issue with the TMP directory on the server the sites are on continually getting filled up, to the point where it would stop anything database driven from working.
Now obviously this is a fairly big issue – as most websites nowadays are (or should be) database driven – so we tried various things to see if we could get it to stop filling up, all with no success.
Then our in-house opencart developer Olly noticed some php.ini files within the root, and the /admin folder of all opencart installations, and in these fields was this line;
session.gc_maxlifetime = 12000000;
This number is in seconds, so in hours that would be; 3,334 – which is 138 days!
I’m pretty sure these don’t need to be stored for so long, so if we change that to 3600 – which is exactly one hour – we’re pretty confident that this issue will no longer happen.
If you have a full tmp drive already, and you have SSH access – then try the following command;
cd /tmp
find sess_* -type f -delete
You can tweak the sess_* bit if there are too many to delete in one go, i.e. put sess_0* or sess_1* to only remove a few, keep tweaking it until you can run the main command – and as long as you tweak the php.ini as detailed above you should not have this issue any more 🙂
Hi, thank you for this post I’ve tried doing as you’ve suggested, but it’s not wokrnig.The strange thing is that some of the tables update just fine, but others don’t, and I can’t figure out why. Any ideas?Thank you.
Not off the top of my head – however if you want us to take a look we could do at a small cost to you.