Jump to content
Latest News: (loading..)
Rwe

session db table is getting very large

Recommended Posts

I have the issue that the sessions in the sessions table are  not being cleared so it gets larger and larger . Now it is the largest table in my DB.

I already manual cleared the table before but this is not the way is should be.

How can i fix it to make the expired sessions automaticly being cleared in includes/functions/sessions.php  ?

installed version:

osCommerce Online Merchant v2.3.4.1 CE Frozen

PHP 7.2

session.gc_maxlifetime 1440


:heart: osCommerce?action=AED

I am using osCommerce version 2.3.4.1 CE  Frozen

 

Share this post


Link to post
Share on other sites

You may want to do a search on "session table" (including the quotes) for more discussion on this. There is a Database Optimizer add-on:

that removes old sessions. That might be useful for you.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites

I had a problem when i first moved to PHP 7.X, that the sessions table would not clear, after some digging i noticed that my session.gc_probability was set to 0

you can see what it is set to by checking your server info within tools. then just scroll down or search for it.

to fix it i just set session.gc_probability to 1

by putting/changing

session.gc_probability = 1

in my php.ini file

Share this post


Link to post
Share on other sites

Hi,

Yes you are right,  session.gc_probability is set to 0

But i am on a shared server with no access to the php.ini

Can session.gc_probability = 1 be set in .htaccess  too?

36 minutes ago, puddlec said:

to fix it i just set session.gc_probability to 1

 


:heart: osCommerce?action=AED

I am using osCommerce version 2.3.4.1 CE  Frozen

 

Share this post


Link to post
Share on other sites

did a quick test on my local install, and i put the following at the bottom of my .htaccess file

php_value session.gc_probability 1

 

Share this post


Link to post
Share on other sites

You can try putting a php_value setting in your .htaccess file, but most servers these days will barf with a 500 error. If that happens, talk to your host's tech support to see what you can do about either setting up a php.ini file, or the equivalent (such as user.ini). They've got to have some means of letting you set PHP settings.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites
4 hours ago, Rwe said:

Yes you are right,  session.gc_probability is set to 0

Enabling that is not recommend. The php developers say that if you are going to use it, it should be done via a cron job that runs periodically instead of each time as it will if you change the setting. They also state it may not reliably handle the sessions based on the traffic. See here.

Share this post


Link to post
Share on other sites
37 minutes ago, Jack_mcs said:

Enabling that is not recommend

Ok just when i found out how to  enable that in .htaccess  and php 7.2 without getting server errors :) 

Better not to enable it then.

 


:heart: osCommerce?action=AED

I am using osCommerce version 2.3.4.1 CE  Frozen

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×