News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevShed:
Storing PHP Sessions in a Database
May 02, 2007 @ 10:56:00

Taking a break from some of the design patterns tutorials they've been posting, DevShed shows how, in this new article to easily create a system to store the sessions for your users into a database versus the usual file system route.

There are many reasons to utilize sessions when creating a web-based application using PHP. Session information, by default, is stored in a file on your web server. But what if that becomes a problem? In this article, I'll talk about why you might want to move your PHP sessions to a database, and show you how to do it.

They start off looking at the limitations of normal session handling (when it comes to multiple web servers), making special note of the function that can make database session handling easy - session_set_save_handler. From there on out, the tutorial takes you through the setup of a SessionManager class and int implementation - including examples of reading, writing, and cleaning up data from expires sessions.

2 comments voice your opinion now!
tutorial session database sessionsetsavehandler tutorial session database sessionsetsavehandler


blog comments powered by Disqus

Similar Posts

TutToaster.com: How To Use, Style and Implement Wordpress Shortcodes

Zend Developer Zone: The ZendCon Sessions Episode 2: Best Practices for Sending Mail from PHP

PHPMaster.com: Data Structures for PHP Devs: Graphs

Felix Geisendorfer's Blog: Setting up Xdebug on Mac OS X (or Win32 / Linux)

Juozas Kaziukenas' Blog: Zend Framework and Doctrine. Part 2


Community Events

Don't see your event here?
Let us know!


library voicesoftheelephpant podcast framework interview configure release introduction laravel php7 opinion language series performance api community application symfony2 example conference

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework