views:

42

answers:

2

PHP Version 5.1.6 All day trying..I'm breaking my head now... I understand it but can't make it work. I need to store the session data in a mysql database, cause we're balancing the request among 2 servers, so regular sessions wont work... I need to use this function ... session_set_save_handler ... and I cant make it work..any help greatly appreciated it. Thank you !

A: 

Full script available at:

http://forums.devnetwork.net/viewtopic.php?t=23781

Jud Stephenson
+1  A: 

If you look at the comments on the PHP documentation page for session_set_save_handler(), you can see a full copy of a class that will store the session data into a database.

The basic database schema involves 3 columns: Session ID, Session Data, and Session Timestamp

The Session ID and Session Data are the critical ones, as PHP gives you both. Session ID is a random ID, and Session Data is a serialize()-like string that represents session data.

The timestamp is simply for you figuring out when to delete it.

I also have an old working copy of a Session Handler here in one of my old frameworks.

Chacha102