Session Problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neugent
Forum Newbie
Posts: 24
Joined: Wed Jul 06, 2005 3:35 am
Location: Philippines

Session Problems

Post by neugent »

How can i prevent my sessions from expiring just like this forum? My clients are getting annnoyed that they get to re-login again and again everytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correctly? or not...
Thanks in advance.e_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();

Am i doing this correctly? or not...
Thanks in advance.g my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correcton_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();

Am i doing this correctly? or not...
Thanks in advance.;
$cache_expire = session_cache_expire();

session_start();

Am i doing this correctly? or not...
Thanks in advance.ing annnoyed that they get to re-login again and again everytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

[pmy sessions from expiring just like this forum? My clients are getting annnoyed that they get to re-login again and again everytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correctly? or not...
Thanks in advance.verytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();[/php:1owsers yet. I think the duration is around 30 minutes. 

Ive tried using the following:

Code: Select all

session_cache_limiter('pagain everytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes. 

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correctly? or not...
Thanks in advance. everytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correctly? or not...
Thanks in aexpire(120);
$cache_expire = session_cache_expire();

session_start();

Am i doing this correctly? or not...
Thanks in advance.not...
Thanks in advance.to re-login again and again everytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correctly? or not...
Thanks in advance.um? My clients are getting annnoyed that they get to re-login again and again everytime they stop browsing my site even though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correctly? or not...
Thanks in advance.ven though they havent logged out or closed their browsers yet. I think the duration is around 30 minutes.

Ive tried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am ried using the following:

Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();
Am i doing this correctly? or not...
Thanks in advance.session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

session_cache_expire(120);
$cache_expire = session_cache_expire();

session_start();

Am i doing this correctly? or not...
Thanks in advance.
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

it uses miliseconds. 1000 is one second i believe
neugent
Forum Newbie
Posts: 24
Joined: Wed Jul 06, 2005 3:35 am
Location: Philippines

Post by neugent »

Can any admin/mods move this topic over the PHP-Code Section? I mistakenly posted this over the general discussion.

So Sorry.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

i think you will be forgiven this time! no but seriously use this because its an amazing function that will do just what you need

session_set_cookie_params()
thedamo
Forum Newbie
Posts: 9
Joined: Fri Jul 15, 2005 7:23 am
Location: Sydney Australia

session timeout issues

Post by thedamo »

You could always change the lifetime directive in the php.ini file as below:

session.cookie_lifetime = 0

Lifetime in seconds of cookie or, if 0, until browser is restarted.

Does this help? Or do specifically need to do it from within php?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

moved to PHP Code
neugent
Forum Newbie
Posts: 24
Joined: Wed Jul 06, 2005 3:35 am
Location: Philippines

Post by neugent »

I have found the problem regarding this, it seems that Apache cleans up the temp folder with a specified time, which causes my session's timeouts.

To solve this, in your .htacess add the following:

php_value session.save_path /home/mytemp/

Make sure you have created the mytemp folder and had given access to it, i have set mine to 777.
Post Reply