Date: 11/30/00
- Next message: R.B. Scholtus: "[phplib-dev] Fw discussion 1: [phplib] PHPlib session using PHP4 sessions implementation: the code"
- Previous message: Matt Grest: "RE: [phplib-dev] Changing error message when use IMAP_OPEN"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
----- Original Message -----
From: Max Derkachev <kot <email protected>>
To: <phplib <email protected>>
Sent: Thursday, November 30, 2000 1:46 PM
Subject: [phplib] PHPlib session using PHP4 sessions implementation: the
code
> I've made an implementation of PHPLib's Session class that uses PHP4
> native sessions.
> It uses PHPLib's CT_* custom storage containers, and functioning just
> like good old PHPLib (I guess :)). It is almost fully compatible with
> PHPLib 7.2 distribution.
> For me, it works pretty well, my benchmark (script execution timing)
> showed almost 2x performance boost (Pentium200 Linux Debian 2.2 box), I
> guess because of using session_encode in serialize() method instead of
> serialize() written in php. Also there is no need now in using eval() in
> thaw(), since php now takes care for it.
> To use it, copy the files to PHPLib's directory and make appropriate
> changes in prepend.php.
> I haven't got the sense of using $sess->in property, and did not
> included complete support for it, and you should change something in
> auto_init file, if you use auto_init, since it is called every time the
> script is executed. I use Cart class, and changed my setup.inc that way:
>
> <?php
> global $sess, $cart;
> if (!$sess->is_registered('cart')) $cart = new My_Cart;
> $cart->start();
> ?>
> to make sure that the $cart object won't be reinitialized and all cart
> data lost, if the object is a registered session variable.
>
> $sess->freeze is excluded from page_close() since php takes care of
> saving session data, and there is no need to call page_close anymore, if
> you're not using User class, I guess.
>
> I tested it with an existing application built with PHPLib 7. It works
> here at php-4.0.3pl1 as Apache module, CT_Sql container and mysql's
> DB_Sql. All the classes except Session remain unchanged. No changes in
> the database. Some changes made to page.inc (page_open() and
> page_close()). I tried it with php4.0.2, but there was a weird error -
> it seemed that prepend.php was cached somewhere, and php issued an error
> (trying to redeclare classes from files require()'d by prepend.php). I
> swear I did not included that files twice :). I did even try to hack
> prepend.php to change require() to require_once(), include_once() or
> die(), etc. No luck. With php4.0.3pl1, however, it works perfectly.
> I'm not sure that User class will work with that implementation, I guess
> some changes to the User class should be done (methods freeze() and
> thaw(), I suppose), but I did not look through it since I don't use the
> User class currently.
>
> I'd be very appreciated if someone send me a
> note/corrections/improvements/etc. I'd be happy to see my code in CVS
> tree also :). Good luck.
>
> --
> Best regards,
> Max A. Derkachev mailto:kot <email protected>
> Symbol-Plus Publishing Ltd.
> phone: +7 (812) 324-5353
> http://www.Books.Ru -- All Books of Russia
>
>
>
----------------------------------------------------------------------------
----> --------------------------------------------------------------------- > To unsubscribe, e-mail: phplib-unsubscribe <email protected> > For additional commands, e-mail: phplib-help <email protected>
- application/x-compressed attachment: session4.tar.gz
--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected> For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: R.B. Scholtus: "[phplib-dev] Fw discussion 1: [phplib] PHPlib session using PHP4 sessions implementation: the code"
- Previous message: Matt Grest: "RE: [phplib-dev] Changing error message when use IMAP_OPEN"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

