Re: [PHP4BETA] Session with MySQL

From: Date: Fri, 17 Sep 1999 06:11:43 +0000
Subject: Re: [PHP4BETA] Session with MySQL
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-4555@lists.php.net to get a copy of this message
On Fri, Sep 17, 1999 at 02:37:55AM +0200, Sascha Schumann wrote: > On Thu, Sep 16, 1999 at 10:51:09AM -0700, John Hamlik wrote: > > We run php3 on a server cluster and have written our own session object > > that stores its information in a MySQL database. I know php4 now > > includes a session object that is very similiar to the one we have > > written. My questions are: > > > > Can the built in session object store its information in a MySQL > > database? > > Providing user level functions has to be implemented yet. It's implemented now. I've attached a demo which demonstrates how this facility can be used. Output of script: $ ./php save_handler.php Content-Type: text/html Set-cookie: PHPSESSID=f08b925af0ecb52bdd2de97d95cdbe6b open (/tmp, PHPSESSID) read (f08b925af0ecb52bdd2de97d95cdbe6b) write (f08b925af0ecb52bdd2de97d95cdbe6b, foo|i:2;) close You would have to extend the functions to cover MySQL. -- Regards, Sascha Schumann Consultant

<? function open($save_path, $session_name) { echo "open ($save_path, $session_name)\n"; return true; } function close() { echo "close\n"; return true; } function read($key) { echo "read ($key)\n"; return "foo|i:1;"; } function write($key, $val) { echo "write ($key, $val)\n"; return true; } function destroy($key) { return true; } function gc($maxlifetime) { return true; } session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); session_start(); $foo++;
« previous php.version4 (#4555) next »