LamivNahdus Posted April 23, 2008 Share Posted April 23, 2008 Hello, I need to create a session which will not expire at all. I have searched the php.net site in its documentation. But iam not able to get the point clearly. I know that sessions will expire after some frequent initialization through session_start(). But how to avoid this? My session should not expire so that user can be signed in forever. Please help me by providing a good explanation... Thank you Link to comment https://forums.phpfreaks.com/topic/102477-session-without-expiration/ Share on other sites More sharing options...
TEENFRONT Posted April 23, 2008 Share Posted April 23, 2008 use cookies? Link to comment https://forums.phpfreaks.com/topic/102477-session-without-expiration/#findComment-524755 Share on other sites More sharing options...
LamivNahdus Posted April 23, 2008 Author Share Posted April 23, 2008 Yes, iam using cookies only. But i need the session that is stored in my server not to be expired. Link to comment https://forums.phpfreaks.com/topic/102477-session-without-expiration/#findComment-524837 Share on other sites More sharing options...
PFMaBiSmAd Posted April 23, 2008 Share Posted April 23, 2008 Sessions are intended to propagate data between pages on your site for the duration of one visit. They are not intended to hold data forever (the maximum time you can set using php is the year 2038.) You can make a session last until 2038 by setting the session.cookie_lifetime, the session.gc_maxlifetime, and if on a shared server, setting the session.save_path to be a private folder in your account space so that garbage collection running due to other php scripts won't delete your session data files. However, the proper way to "remember" that a visitor is logged in between visits, is to use a regular cookie with an expire time of your choice to hold a unique identifier (not their user name as that can be easy to guess) that you store in your database in their user record and remember that they are logged in using a field in your database. Link to comment https://forums.phpfreaks.com/topic/102477-session-without-expiration/#findComment-524844 Share on other sites More sharing options...
LamivNahdus Posted April 24, 2008 Author Share Posted April 24, 2008 Thank you so much for your explanation. Bu how can i change the values you have said? I used .htaccess file with following configuration: php_value session.cookie_domain .example.com php_value session.name sess But this produced a 500 Internal server error. What to do? There is also one more file inside my hosting web directory named php.ini. I added two lines into that file as session.name = sess session.cookie_domain = .example.com But the changes are not affected, when i used phpinfo() function. What to do? How to use php.ini in my web directory? Thank you... Link to comment https://forums.phpfreaks.com/topic/102477-session-without-expiration/#findComment-525768 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.