Prev | Current Page 516 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

The most relevant are introduced in this section.
Managing the Session Storage Media
The session.save_handler directive determines how the session information will be
stored. Its prototype looks like this:
session.save_handler = files|mm|sqlite|user
Session data can be stored in four ways: within flat files (files), within volatile
memory (mm), using the SQLite database (sqlite), or through user-defined functions
(user). Although the default setting, files, will suffice for many sites, keep in mind for
CHAPTER 18 ?–  SESSION HANDLERS 449
active Web sites that the number of session-storage files could potentially run into
the thousands, and even the hundreds of thousands over a given period of time.
The volatile memory option is the fastest for managing session data, but also the
most volatile because the data is stored in RAM. The sqlite option takes advantage of
the new SQLite extension to manage session information transparently using this
lightweight database (see Chapter 22 for more information about SQLite). The fourth
option, although the most complicated to configure, is also the most flexible and
powerful, because custom handlers can be created to store the information in any
media the developer desires. Later in this chapter you??™ll learn how to use this option
to store session data within a MySQL database.
Setting the Session Files Path
If session.


Pages:
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528