I want to set joomla front end session to never expire automatically.I am thinking that session time out limit should be 45 days so that users visiting site even after 44 days they still be logged in.I set session timeout limit in back end in the global configuration to expire in 64800 minutes and also I updated the session.gc_maxlifetime to say 3888000 but still it is not working.
Joomla creates the cookie with the name d58ba4091c622661a0d46f03b412ac8b and expiry time says 'At end of session'.
This means that session will expire whenever a user close the browser.
Expiry time should be changed for this cookie according to configuration settings but it still say At end of session .
for an example how stackoverflow session works I need to do in same way.
Is there any way to change this cookie life time from 'At end of session' to something I want?
Should I hard code time limit where this cookie come in existences or how to do this?
Thanks.
Use this plugin:
http://extensions.joomla.org/extensions/administration/admin-desk/13982
You definitely don't want to make the session never expire because this will cause all kinds of server and security issues. You need to change the expiration of the cookie to some date in the future. The easiest way to do this would be a plugin that checks for the cookie and updates the exiration.
Related
When my users login, I want to set the amount of time before the session expires.
I've accomplished this by setting the lifetime in session_set_cookie_params.
When I look at the cookie's expiration date it says:
Saturday, December 8, 3296 at 11:45:08 AM
But when I come back after an hour the cookie is there but my site won't recognize it. Why won't my site recognize or use the cookie?
Cookie contains only session identifier. The data itself is stored on server side. PHP periodically deletes expired sessions. When you're returning after one hour, session data is already lost and session ID from your cookie can't match to anything.
Chck out session.gc_maxlifetime (http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime) for more info.
I am developing a simple php website named : http://www.dopanchat.com
In this site I used session to develop the login system, everything work fine but after some amount of time (for example, after 1 hour) the session expires automatically and user logged out from my site.
I don't know if it's server problem or anything else.
please help me to resolve this problem, you can check here : http://www.dopanchat.com
Extending your session timeout is an approach but I won't recommend to expand it too much :)
Instead your application could detect user activities and refresh the session expiry time accordingly.
After all it doesn't really matter what is the session's timeout at some point user will lose the authentication due to the expired session.
Basically the expiry count down always starts after user's last action and not from the moment s/he logged in to your system.
Try this :
// Time in secondes before the session expires
ini_set('session.gc_maxlifetime', 3600);
// Time in secondes before the ID's session in the cookie expires
session_set_cookie_params(3600);
// Start session
session_start();
If think this gonna work. Tell me if it work !
(Sorry for my bad english :D)
you can extend session expire time by adjusting php.ini file as follows
session.gc_maxlifetime=86400 //1 day
session.gc_divisor=5000
session.gc_probability=1
gc_divisor and gc_probability are responsible for cleaning expired session files, by above config session will valid for 1 day
I have a social website. People use login with username and password. I am creating a session when they log in but some time later session time ends and they have to log back in again. I used the code below to make this time longer but still sometime later session time runs out. I checked SESSID with cromes cookie viewer and saw session still has time but in the browser it does not see that time. I hope i explained my problem well. Here is the code to create the session on login:
$lifetime=3600*24*7;
session_start();
setcookie(session_name(),session_id(),time()+$lifetime);
You need to take a look at: session.gc_maxlifetime in your configuration. This needs to have a high enough value, to keep the session alive. Also if you are using Memcache or some other caching for your sessions, the TTL there needs to be set, too.
I made a website with login features, but sometimes users are automatically logged out. I have other websites and have never experienced this issue before. My website is hosted. My session script is
if(#username and password is match#)
$_SESSION['front_end_user'] = $username;
The difference between this website and my other website is that in this website I use full jquery interaction. Could this effect the session? If not what is the problem?
I have checked all my pages and there are no session_destroy or unset statements.
The session usually expires after 24 minutes. By the way you can set this session timeout to last more, but I'd not suggest this. I'd use a cookie solution. (For this google "remember me tutorial" and you'll find out).
I think this is session time out. Your session is timing out after a certain amount of time and this is a normal behaviour of all applications.
PHP's default session time out value is 24 minutes. This mean that session will be timed out after the inactivity of 24 minutes.
Although you can increase session time out limit but note that should not be big amount.
I have a web application that pings a database every minute or so to check for new entries. The page is designed to not really have any interaction with... You just keep it open and it displays things. The page is password protected, and the site can be up for a coupe days without anyone clicking in the web browser or anything. I've found after it's up for like a day or so it stops checking the database (through an Ajax request) and then if you refresh the page manually it brings you to the login page again. I'm assuming that's because the session which has the login information expires. I never set an expiration time, but does PHP automatically destroy the sessions after a certain amount of time? What do I do to fix this?
Thanks
Thanks for all the replies... Is there a way to set the session to never expire with out just changing the PHP settings themselves?
The default value of session.gc_maxlifetime is 1440 seconds. So the garbage collector assumes a session to be expired when the last modification was at least 1440 seconds ago.
Note that when using a cookie for the session ID it might have a different lifetime. The default value 0 of session.cookie_lifetime makes the cookie a session cookie, that means it expires when the browser session is ended (i.e. the browser is closed).
See also my answer on How do I expire a PHP session after 30 minutes? for further information on session expiration.
From php.ini:
; Lifetime in seconds of cookie or, if
0, until browser is restarted. ;
http://php.net/session.cookie-lifetime
session.cookie_lifetime = 0
That would be the default if I'm not mistaken. Either set it to zero (if it's not already set) or just use another cookie.