sessions and expirations and isolations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, in ASP, sessions expire when the client does not request an asp
page for more than 20 min. (The 20 min thing is a server level setting
- which can be changed by IIS settings )  And sessions work out of the
box.

I use sessions a lot. So, most likely, I would keep that style in my
PHP apps too.

I read the following about PHP sessions...  I wanted to know how
accurate this info is.

<quote>
The default behaviour for sessions is to keep a session open
indefinitely and only to expire a session when the browser is closed.
This behaviour can be changed in the php.ini file by altering the
line:

session.cookie_lifetime = 0
If you wanted the session to finish in 5 minutes you would set this to:

Listing 23 Keeping a session alive for five minutes (listing-23.txt)
session.cookie_lifetime = 300.
Remember to restart your web server after making this change.
</quote>


Now, if this info is correct and it is this simple, why do we have
some elaborate posts like this one?

http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes


What do you do when you write a PHP app that relies on sessions? how
do you manage the server memory allocation issues?
Say you wanted to keep session vars alive for 20 min ( from the last
request from the client ) and you wanted your server to completely
empty the session if there no request, no new php page is requested
from that client within that next 20 min. And if a client requests a
page say on the 19th min, session gets extended another 20 from that
time on, just like the ASP works.

My second question on session is abut keeping sessions apart from one
another - if such a concept exists...

Let's say you have a session var FirstName in app1 and another session
variable exactly named as FirstName in app2.
how do you keep them seperate?

In ASP, I create a virtual app at the IIS server - assigning a virtual
dir path to the app, and from that point on, any page being served
under that virtual path is treated as an isolated ASP app and thus the
sessions are kept isolated and not get mixed up by asp pages that do
not live under that virtual app path.

Is this concept even applicable in PHP?

Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux