osCommerce: How to increase session lifetimePublished: Sunday, 11 November 2012 16:17 Written by Ogri Hits: 12097
The default session duration in OSC is 1440 seconds (24 minutes). There is the following code snippet in the file /includes/functions/sessions.php
:
if (STORE_SESSIONS == 'mysql') {
if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {
$SESS_LIFE = 1440;
}
//--------- More code... -----------
}
The first line indicates that the session must be stored in a database. An appropriate parameter in the file configure.php
should be assigned like this:
define('STORE_SESSIONS', 'mysql');
2nd line: get_cfg_var
function extracts session length from the php.ini
. You can edit it by changing a value of the parameter session.gc_maxlifetime
from 1440 to a different one. I set 2400 seconds (40 minutes). Here is a piece of php.ini
:
; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 2400
Bear in mind that the change of session.gc_maxlifetime
parameter will alter the value of session duration in the entire scope of the php.ini
on the server. If you do not want to change it that globally - edit the above code in sessions.php
:
- Remove or comment out the 2nd and 4th lines. This will disable the check of
session.gc_maxlifetime
setting in the PHP server configuration. - In the third line, change the
$SESS_LIFE
value from 1440 to the desired - for example, to that same 2400.
The resulting code is:
if (STORE_SESSIONS == 'mysql') {
$SESS_LIFE = 2400;
//--------- More code... -----------
}
Session timeout is now increased locally - only for our OSC project.
Notes:
1. If you close the browser - the session will get closed as well.
2. For safety reasons, do not set the session to be too long. 3600 seconds (60 minutes) is the upper limit of safety.
3. You can control the session lifetime for the front-end separately from the one for an administrative service by editing individually /includes/functions/sessions.php
and /admin/includes/functions/sessions.php
files respectively.
Latest News
-
Tuesday, 21 July 2020 03:18
Joomla 3: Redirect to same page after successful login -
Saturday, 30 December 2017 16:11
Joomla: how to add your own language constants or override existing ones -
Thursday, 30 November 2017 23:27
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
Saturday, 25 June 2016 15:33
Unified filtering of mod_jcomments_latest module's output -
Thursday, 17 September 2015 16:23
Post an illustrated Joomla-site article on Facebook using OG-tags
Articles Most Read
-
139047
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments -
69458
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
40731
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions -
38202
Editing animated GIF-images in Photoshop CS3 -
34972
Migrating from Joomla 1.5 to Joomla 2.5. Part 1. Transferring content
Login
Guest Column
Recent comments
-
Editing animated GIF-images in Photoshop CS3
-
출장마사지 04.02.2023 09:19
-
-
Joomla: Content filtering by articles, categories and components
-
강남출장마사지 04.02.2023 12:45
I have been exploring for a little for any high-quality articles or blog posts on this kind of area .
-
-
Joomla: Merge two sites into one using component J2XML
-
mmorpg 04.02.2023 05:34
We stumbled over һere from a different website and thought I ѕhould check things out. I liқe what ...
-
-
Migrating from Joomla 1.5 to Joomla 2.5. Introduction
-
출장마사지 04.02.2023 13:38
Amazing things here. I'm very glad to look your post. Thank you a lot and I'm having a look forward to ...
-
-
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions
-
카지노사이트 04.02.2023 13:03
메이저카지노 메이저카지노 카지노게임 카지노 카지노사이트 온라인카지노 바카라 바카라사이트 온라인바카라 사이트포럼 메이저카지노 메이저카지노 카지노게임 카지노 카지노사이트 ...
-
온라인바카라 04.02.2023 09:56
메이저카지노 메이저카지노 카지노게임 카지노 카지노사이트 온라인카지노 바카라 바카라사이트 온라인바카라 사이트포럼 메이저카지노 메이저카지노 카지노게임 카지노 카지노사이트 온라인카지노 바카라 ...
-
카지노사이트 04.02.2023 09:19
메이저카지노 메이저카지노 카지노게임 카지노 카지노사이트 온라인카지노 바카라 바카라사이트 온라인바카라 사이트포럼 메이저카지노 메이저카지노 카지노게임 카지노 카지노사이트 온라인카지노 바카라 ...
-
สล็อต pg เว็บตรง 04.02.2023 05:54
Very nice post. I just stumbled upon your weblog and wanted to say that I've really enjoyed surfinng ...
-
-
Unified filtering of mod_jcomments_latest module's output
-
출장마사지 04.02.2023 06:50
Valuable info. Fortunate me I found your web site by chance, and I am stunned why this coincidence ...
-
출장안마 04.02.2023 05:30
excellent issues altogether, you just gained a new reader. What may you suggest in regards to your ...
-
Read more...