Prev | Current Page 517 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

save_handler is set to the files storage option, then the session.save_path
directive must be set in order to identify the storage directory. Its prototype looks
like this:
session.save_path = string
By default session.save_path is set to /tmp. Keep in mind that this should not be set
to a directory located within the server document root, because the information could
easily be compromised via the browser. In addition, this directory must be writable
by the server daemon.
For reasons of efficiency, you can define session.save_path using the syntax N;/path,
where N is an integer representing the number of subdirectories N-levels deep in
which session data can be stored. This is useful if session.save_handler is set to files
and your Web site processes a large number of sessions, because it makes storage
more efficient since the session files will be divided into various directories rather
than stored in a single, monolithic directory. If you do decide to take advantage of this
feature, PHP will not automatically create these directories for you. However, Linux
users can automate the process by executing a script named mod_files.sh, located in
the ext/session directory. If you??™re using Windows, this shell script isn??™t supported,
although writing a compatible script using VBScript should be fairly trivial.
Automatically Enabling Sessions
By default a page will be session-enabled only by calling the function session_start()
(introduced later in the chapter).


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