Prev | Current Page 522 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"


CHAPTER 18 ?–  SESSION HANDLERS 453
Setting Cache Expiration Time for Session-Enabled Pages
The session.cache_expire directive determines the number of seconds (180 by default)
that cached session pages are made available before new pages are created. Its prototype
follows:
session.cache_expire = integer
If session.cache_limiter is set to nocache, this directive is ignored.
Setting the Session Lifetime
The session.gc_maxlifetime directive determines the duration, in seconds (by default
1440), for which a session is considered valid. Its prototype follows:
session.gc_maxlifetime = integer
Once this limit is reached, the session information will be destroyed, allowing for
the recuperation of system resources.
Working with Sessions
This section introduces many of the key session-handling tasks, presenting the relevant
session functions along the way. Some of these tasks include the creation and
destruction of a session, designation and retrieval of the SID, and storage and retrieval of
session variables. This introduction sets the stage for the next section, in which
several practical session-handling examples are provided.
Starting a Session
Remember that HTTP is oblivious to both the user??™s past and future conditions.
Therefore, you need to explicitly initiate and subsequently resume the session with
each request. Both tasks are done using the session_start() function.


Pages:
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534