Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 11. Sessions and Data Persistence > Storing Sessions in a Database

Recipe 11.4. Storing Sessions in a Database

11.4.1. Problem

You want to store session data in a database instead of in files. If multiple web servers all have access to the same database, the session data is then mirrored across all the web servers.

11.4.2. Solution

Use a class or a set of functions in conjunction with the session_set_save_handler(  ) function to define database-aware routines for session management. For example, use PEAR’s HTTP_Session package for convenient database session storage:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial