I went through and installed mcache and took notes about problems I ran in to. I couldn't get it to work in 64 bit CentOS but it works in 32 bit CentOS. If anybody got it working in 64 bit or wants to see what I have done, please feel free to visit my blog (i didn't want to spam post all the things here). Here is the blog: http://crazytoon.com/mcache
LXXXII. Mohawk Software Session Handler Functions
msession is an interface to a high speed session daemon which can run either locally or remotely. It is designed to provide consistent session management for a PHP web farm. More Information about msession and the session server software itself can be found at http://devel.mohawksoft.com/msession.html.
Nota: Questo modulo non √® disponibile su piattaforme Windows.
To enable Msession support configure PHP --with-msession[=DIR], where DIR is the Msession install directory.
- msession_connect -- Connect to msession server
- msession_count -- Get session count
- msession_create -- Create a session
- msession_destroy -- Destroy a session
- msession_disconnect -- Close connection to msession server
- msession_find -- Find all sessions with name and value
- msession_get_array -- Get array of msession variables
- msession_get_data -- Get data session unstructured data
- msession_get -- Get value from session
- msession_inc -- Increment value in session
- msession_list -- List all sessions
- msession_listvar -- List sessions with variable
- msession_lock -- Lock a session
- msession_plugin -- Call an escape function within the msession personality plugin
- msession_randstr -- Get random string
- msession_set_array -- Set msession variables from an array
- msession_set_data -- Set data session unstructured data
- msession_set -- Set value in session
- msession_timeout -- Set/get session timeout
- msession_uniq -- Get unique id
- msession_unlock -- Unlock a session
Mohawk Software Session Handler Functions
Has been renamed to Mcache, improved, and is available at http://www.mohawksoft.org/
Trying to build PHP 5.0.4. with msession support (shared), I found that the build process still fails to link the proper libraries. I think the proper way to fix this, is to change ext/msession/config.m4 and rebuild configure.
Find the line that reads:
PHP_ADD_LIBRARY_WITH_PATH(phoenix, "$PHOENIX_DIR/lib", PHOENIX_LIB)
And replace it with these two lines:
PHP_ADD_LIBRARY_WITH_PATH(phoenix, "$PHOENIX_DIR/lib", MSESSION_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(stdc++, "", MSESSION_SHARED_LIBADD)
Next find the line that reads:
and replace it with:
Now rebuild "configure":
$ rm configure
$ ./buildconf --force
Now ./configure && make && make install as usual.
Hi all, I'm the author of the msession daemon. I haven't done any actual work on it in a couple years. Suddenly, I find myself needing it again. It's current state is almost certainly VERY different than you are used too, and it as been renamed to mcache (internally to Mohawk Software). I may ramp up work on it again.
In the course of the 5 years that msession being made available, I've gotten a lot of calls for support, and one bug fix. (And not a single donation BTW)
A decisions needs to be made if "mcache" will continue to be available. I don't mind people using it, I don't mind that I've made no money on it (that's not why I wrote it), but the desperate "my server farm is down" calls because a working system died when the admin deployed changes with out adaquite testing are a huge distraction. In good conscience, I can't let the poor guy twist in the wind, but sometimes it takes hours to fix. Hours away from work that pays my bills or my family. Apache 2.0 with multiple threads really caused a lot of problems.
So, I guess what I'm saying is this: msession will become mcache (publically) some time in the future. On modern hardware it can handle about 5,000 ~10,000 session transactions a second (depending on the amount of data in the session, and the conectivity to the nodes, etc.) I may keep it on my server, but I can't support it for you without being paid up front. If you use it: learn it, know it, live it, and contribute if you can.
I could not compile it on FreeBSD. On a 4.x msession complained about missing pthread library. On a 5.x, it was not happy with malloc.h. Ok, I could dig into that problem and find the problem. But I was not motivated...
I found that there is 1 100% PHP Solution for distributed session handling:
We wanted to use the default-PHP4-RPMs delivered with RedHat and SuSE, and use msession, too. But there is no package containing the precompiled msession-support for PHP. So I did this on my own and I found it very hard, so I'd like to provide the solution here.
The files php-msession-030117.tar.gz, phoenix-R1_2_030117E.tar.gz and msession-030130.tar.gz are
available at www.mohawksoft.com.
## Compiling the phoenix lib
tar xzf phoenix-R1_2_030117E.tar.gz
tar xzf msession-030130.tar.gz
cp Linux.mak config.mak
(Now change "-I$(POSTGRES_HOME)/include" to "-I /usr/include/pgsql" which is needed to compile using SuSE 9.3)
## Compiling msession server
## Now untar PHP-Source and replace the files in ext/msession/ with the ones supplied by php-msession-030117.tar.gz
## Configure PHP and include --with-msession=shared,/path/to/phoenix-src-used-above
## Please note: Compile will fail if you use --disable-session or --disable-all
## For example use:
./configure --prefix=/usr/local --with-config-file-path=/etc --disable-all --enable-session --with-msession=shared,/home/sga/compile/phoenix
## Now there is a msession.so in modules/, but this one does NOT work yet.
## I had to repeat the libtool-command with "--mode=link gcc" and add some libs:
## before the last parameter I added:
## -lstdc++ -lodbc -L/home/sga/compile/phoenix/lib/ -lphoenix
## This was the command I used (you will have to use other paths of course)
/bin/sh /home/sga/compile/php-4.3.10/libtool --silent --preserve-dup-deps --mode=link gcc -DPHP_ATOM_INC -I/home/sga/compile/php-4.3.10/include -I/home/sga/compile/php-4.3.10/main -I/home/sga/compile/php-4.3.10 -I/home/sga/compile/php-4.3.10/Zend -I/home/sga/compile/php-4.3.10/ext/xml/expat -I/home/sga/compile/php-4.3.10/TSRM -g -O2 -o ext/msession/msession.la -export-dynamic -avoid-version -prefer-pic -module -rpath /home/sga/compile/php-4.3.10/modules -lstdc++ -lodbc -L/home/sga/compile/phoenix/lib/ -lphoenix ext/msession/msession.lo
## Now I could do:
cp ext/msession/.libs/msession.so /usr/local/lib/php/extensions/no-debug-non-zts-20020429
## (Please note the different location I copy the module from)
## Adjust your php.ini to contain "extension=msession.so" and
## "extension_path =/usr/local/lib/php/extensions/no-debug-non-zts-20020429"
## Now it worked fine! I hope this helps someone.
To compile with --with-msession, you have to make a change in Makefile to add -lstdc++. For me the LDFLAGS=-lstdc++ before ./configure don't work.
That modification works for me:
sed -e 's/^\(EXTRA_LIBS\)\(.*\)$/\1\2 -lstdc++/g' Makefile -i
I think that have some better way to do it.
A company I work for uses msession for a large cluster of servers. I've set it up rather regularly and never had an issue at all with it not working.
Msession is stable. It does something simple- it maintains an efficient database of key->value (session->data) pairs and searches them well in a nice threaded manner. There is no need for constant revision. It is _NOT_ a large application. It's security is simply IP-block-based, so such concerns are also minimal.
To the user that says it should be removed- if you are having problems installing it, seek assistance doing so. The product itself is just right.
Compiling msession can be quite a pain. Believe me.
Here's how I did it on a gentoo-box with gcc version 3.3.4 (20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)):
1. Download http://www.mohawksoft.com/devel/phoenix-R1_2_030117E.tar.gz and http://www.mohawksoft.com/devel/msession-030130.tar.gz
2. Extract them in /usr/local (That path is hardcoded, so you don't really have a choice since there isn't a configure script)
3. You should now the directory /usr/local/phoenix containing msession and src.
4. Enter the src-directory and rename Linux.mak to config.mak (or the corresponding file, if you're using another system. Don't use unixgcc.mak directly - it won't work.).
5. Type make
6. Type make install. You might have to create /usr/local/phoenix/lib yourself and then type make install again.
7. Change into the msession-directory and type make.
For both msession and phoenix you may have to edit the makefiles manually and comment out the postgreesql and odbc-code (if you don't have postgree installed).
8. Recompile php with --with-msession.
msession 1.0 (020603) is using /dev/urandom.
You can fix the no random data in FreeBSD's /dev/random by using rndcontrol (as root) and setting the interupts which it looks at for entropy.
Something like rndcontrol -s 14 -s 15 should help it out.
If you have trouble connecting to the msessiond from a php-script, this might be the solution for you.
msessiond (and your php-extension) both use the libphoenix.a which, among other files, is built from a file called "mutils.cpp".
Open this file, and find a line saying:
FILE *f = fopen("/dev/random", "rb");
(I believe it is line 506. There's only this one.)
On my FreeBSD 4.5 Tiny, /dev/random seldom spits out data, so the program hangs on the next line (an fread() call). Use /dev/urandom instead, it always sends data.
Change the line above to:
FILE *f = fopen("/dev/urandom", "rb");
Then rebuild phoenix-lib, msessiond, and PHP. You might want to do a "make clean" to be sure the change is noted.