Session management module - thoughts
| From: | Zeev Suraski | Date: | Fri, 28 May 1999 13:24:58 +0000 |
| Subject: | Session management module - thoughts | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6149@lists.php.net to get a copy of this message | ||
Hey,
Looking at PHP 4.0, one of the only major issues in which it falls behind
ASP is internal session management.
I know Rasmus always said this stuff belongs in user space, but basically,
my opinion is that anything that more than a few people use, is better off
being written in native C.
I know PHPlib uses a database backend to store session information, and
passes around a session id through GET. That means, pretty much, that you
have to set up many things and completely modify the way your page works
(only use phplib to emit URLs, set up a working database, etc). For the
average John Doe user, this is often the thing that'll prevent him from
using sessions with PHP. Compared to the ease of use involved with
sessions and ASP, getting PHP to work with sessions is a pain.
We've all considered session support in the past, but delayed it since it
involved complex shared-memory code, and perhaps wasn't even too feasible
on UNIX systems (shared memory isn't that easy to work with, and is very
limited).
What I have in mind is a KISS approach to sessions, through a built-in PHP
module. For information storage - use files. Implement functions that
start a session, that add variables to a session, and possibly that end a
session. At request_shutdown, simply store all variables that were
registered as session varaibles in a file, named after a unique key that's
generated by the session starter, and passed along through cookies (I
think it'll be fair to rely on cookies, and point people that don't trust
cookies to phplib's session support).
In essence, assuming we have working serialize functions, all we have to
implement is file locking support and something that will clean up old
sessions, neither of which are beyond us.
What do you guys say?
Zeev
--
-----------------------------------------------------
Zeev Suraski <zeev@zend.com>
For a PGP public key, finger bourbon@netvision.net.il
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net