1

Where can i set default session expire time in WebsiteBaker? It is by default destroying in 10MINS. I want to set more minutes/hours in development period and later want to change to default or x MINS.

Please help me waiting your reply.

Thanks

Gumbo
  • 643,351
  • 109
  • 780
  • 844
Sridhar
  • 11
  • 1
  • The documentation says nothing and I bet you will not find many coders here, who use that CMS. Maybe you just search in your codebase or ask [in the wsbaker-forum.](http://www.websitebaker2.org/forum/) – erikbstack Jan 05 '11 at 07:58

3 Answers3

1

Websitebaker at least the current 2.8.2 Version and the upcomming 2.8.3 Version completely rely on server settings for session lifetime.

If you want different session settings you can add your settings to the config.php just before :

 require_once(WB_PATH.'/framework/initialize.php');

This only works if your Server allows overrides by script.

Another option is to use a .htaccess file or change the server settings.

0

I don't know anything about website baker , so find where the session is started ( in you're project search all files for session_start(); ) , then before that line you can use :

//first parameter expects the number of seconds session cookie should be kept by the 
//browser , in our case 10 seconds
session_set_cookie_params(10);

Or another option , at the root of you're website baker app ( index.php ) add that line and you should be ready to go .

Notes: if session cookie is destroied by the browser then php will issue another session id when you call session_start(); , so we don't realy care if the last session is still considered alive/active as in you're php script you will have an empty $_SESSION . Aditionaly you can set ini_set('session.gc-maxlifetime', 10); so that previous sessions will get deleted by the garbage collector in case you store the sessions on disk .

Poelinca Dorin
  • 9,577
  • 2
  • 39
  • 43
  • [`session_cache_expire`](http://php.net/session_cache_expire) is only for HTTP caching. – Gumbo Jan 05 '11 at 08:12
  • *session.gb\_maxlifetime* is not necessarily better (see http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes/1270960#1270960). – Gumbo Jan 05 '11 at 08:27
0

I assume you haven't changed it yourself (otherwise I guess you'd remember how you did it) and 10 minutes looks like a strange default value. I'd dare say you are hosting your app in a shared server, session data is being stored in the default shared location and there's some other app from another customer that's set a lower session life time. This problem happens because session data is not site-aware: when the PHP garbage collector removes session files that have not been accessed in 10 minutes it removes all the files in the directory; it has no way to know what web site they belong to.

I cannot tell you how to fix it in WebsiteBaker but in regular PHP you need to set a custom session directory within your account. Then (and only then) you'll have full control over your own session data:

session_save_path('/home/users/foo/sessions');
ini_set('session.gc_maxlifetime', 3*60*60); // 3 hours (or whatever you need)
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 100);
session_start();
Álvaro González
  • 142,137
  • 41
  • 261
  • 360