Mcache: Install and configure mcache (msession) to be used for session caching in PHP.

Installing mcache, previously known as msession, on CentOS 32 bit system.

If you are on 64 bit system, you will get errors, lots of them.  I went through and fixed “some” errors by modifying code but it was just taking too much time so I decided not to go 64 bit route.  But below are the efforts I made.  Maybe somebody can help with rest of the steps.   Following instructions work fine with 32 bit systems. For more help look at the MCache Handbook.
Thank you Mohawk Software for all your efforts developing this!

Web site:
PHP reference:

yum install ncurses-devel #otherwise you might see errors about no such file curses.h

tar zxf mcache*.gz
tar zxf phoenix*.gz
cd phoenix
ln -s Linux.mak config/config.mak
make dirs
make links
make butils
export PATH=$PATH:/opt/mohawk/bin
make libs
vi sqldrv/Makefile # about line 24, comment out POSTGRES=1 and ODBC=1
cd ../mcac*
make server
vi tools/Makefile # after line which says: CARGS+=-DBINDIR=\"$(BINDIR)\"
                  # add:  CARGS+=-DSBINDIR=\"$(SBINDIR)\"
make utils
ln -s /opt/mohawk/lib/ /lib/
/opt/mohawk/sbin/mcache &

In your php.ini, add:   
; Use mcache as the save handler
session.save_handler = mcache
; Set the host which runs the mcache daemon
session.save_path = localhost

Let us test if mcache server is running:

You should see:
Usage: /opt/mohawk/bin/mping host
Pings a session daemon
Using localhost
localhost:8086 is alive

Great! You mcache server is now up and running and listening for connections.

You can add above command to your start up scripts so server will run next time you reboot.  Easiest way to achieve this is to add that command to end of /etc/rc.local

32 bit installation is now complete! 


I could not get 64 bit install to go but here are my notes for whoever wants to try it.  If you get it working, please come back and comment on how you got it installed.

64 bit install notes:First error:  CPU you selected does not support x86-64 instruction set
to fix this, edit config/unixgcc.mak and remove all instances of -mtune=pentium3

Following are code changes to fix some other errors:

line 83 in phmalloc.h
virtual void *memdup(void *mem, unsigned int cb);
virtual void *memdup(void *mem, size_t cb);

line 446 in mexpat.cpp
static void *xmlalloc(void *context, unsigned int cb)
static void *xmlalloc(void *context, size_t cb)

static void *xmlrealloc(void *context, void *p, unsigned int cb)
static void *xmlrealloc(void *context, void *p, size_t cb)

6 Responses to “ Mcache: Install and configure mcache (msession) to be used for session caching in PHP. ”

  1. martin
    June 8th, 2007 | 2:21 pm

    could you advice how to install php with mcache support ?

  2. Opus
    July 10th, 2007 | 3:01 pm

    Thanks! This worked in Ubuntu as well. I posted a link to your instructions on

  3. Sachin
    December 21st, 2007 | 12:19 am

    Installation was ok, but sessions are not being created..

    Warning: session_start() [function.session-start]: Cannot find save handler mcache in filename.php

    I’m into administartion rather in coding coding side of php so can you please tell me what’s wrong with my settings ???

  4. dormael
    January 10th, 2008 | 5:32 pm

    Thank you for your instructions.

    Everyting works fine.
    But the plugin such as filecache is not installed.
    And sqlite3 plugin seems is not working..

    Did you succeed in activating any cache plugin?

  5. January 13th, 2010 | 9:19 am

    [...] MCache, formally known as msession . Normally, this should be the best choice to set up a session server. However, it suffer to the fact that it’s not able to run on a x86_64 OS as described here:…. [...]

  6. January 13th, 2010 | 9:25 am

    [...] However, it suffer to the fact that it’s not able to run on a x86_64 OS as described here:…. But as the author says, this solution is “a quick and dirty (note: dirty) [...]

Leave a reply

To prove that you're not a bot, enter this code
Anti-Spam Image