Re: session mm storage module info - a tutorial
| From: | Charles Killian | Date: | Thu, 24 Aug 2000 22:42:52 +0000 |
| Subject: | Re: session mm storage module info - a tutorial | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13542@lists.php.net to get a copy of this message | ||
Hi, again. Well I answered all of my own questions and thought I'd share my
learned knowledge with the list.
How To Use The MM Session Module with PHP
First what is it? From Zend.com (http://www.zend.com/zend/tut/session.php):
Session Handling with PHP 4
By Tobias Ratschiller
"Storage Modules
To read and save session data, PHP uses storage modules, thus abstracting
the back end of the library. There are currently three storage modules
available:
-Files. By default, PHP uses the files module to save the session data to
disk. It creates a text file named after the session ID in /tmp. You
probably won't ever need to access this file directly. In the example of the
session counter, the content of this file would look like this, which is a
serialized representation of the variable: counter|i:4;
-mm. If you need higher performance, the mm module is a viable alternative;
it stores the data in shared memory and is therefore not limited by the
hardware I/O system.
-User. Used internally to realize user-level callback functions that you
define with session_set_save_handler()."
Now on to the installation!
Assumptions:
UNIX
PHP installed as an Apache module.
Apache and PHP are currently installed and running.
These are my paths. Type your own.
Grab the latest mm libary:
cd /usr/local/src/
lynx -dump -src "http://www.engelschall.com/sw/mm/mm-1.1.3.tar.gz"
>
mm-1.1.3.tar.gz
gzip -d < mm-1.1.3.tar.gz | tar xf -
Configure mm.
The default install path for mm if you don't use --prefix is: /usr/local/
cd mm-1.1.3
./configure --quiet
Configure PHP.
The mm libray actually installs in /usr/local/lib.
Use this path in php's configure.
So add --with-mm=/usr/local/lib to your current configuration.
cd /usr/local/src/php-4.0.1pl2
./configure --quiet --with-apache=../apache_1.3.12 \
--enable-debug=no --enable-bcmath --with-gd=no --with-mm=/usr/local/lib
make -s clean install
Configure apache again.
cd /usr/local/src/apache_1.3.12
./configure --quiet --prefix=/apache \
--activate-module=src/modules/php4/libphp4.a
Stop apache:
/apache/bin/apachectl stop
make -s clean install
While Apache is stop edit your php.ini file.
Change:
session.save_handler = files ; default is files. mm is in memmory.
users is user defined.
to:
session.save_handler = mm ; default is files. mm is in memmory.
users is user defined.
Start apache:
/apache/bin/apachectl start
Point your browser at a page that calls phpinfo() and make sure the
configure command output contains the mm parameter.
Go into /tmp (if this is where you were storing the session files).
rm -f sess_*
Browse a couple of pages that use sessions.
Check to make sure no sess_* files are in /tmp.
Success!
Charles