I'm using HHVM to serve up my PHP content, and have a memcached instance setup with a view to using it as a save handler for sessions, however I'm not sure that HHVM is actually using it.

Here's the relevant part of /etc/hhvm/php.ini:

session.save_handler = memcached
session.save_path = /tmp/memcached.sock
memcached.sess_prefix = 'php_'

Note; I had to use a session.save_handler value of memcached rather than memcache as used in vanilla PHP. I also had to set a memcached.sess_prefix otherwise I was getting errors about it being empty.

However, if I connect to memcached and request its statistics, it doesn't look as if any sessions are being stored in memcached at all.

Here are the stats for hits/misses:

STAT get_hits 15
STAT get_misses 29

The memcached daemon has been running for several weeks uninterrupted, so these values seem extremely low. In fact I suspect they were probably generated when I briefly used a vanilla PHP installation before switching to hhvm.

There are no errors in /var/log/hhvm/error.log pertaining to memcached, or sessions, so it doesn't appear to be failing to connect, which suggests that it simply isn't trying. Though if that's the case I have no idea how sessions are being stored as they don't seem to be going into /tmp, but they do appear to work (does HHVM/PHP store any session data in RAM itself?)

Everything seems like it's configured correctly, is there something else that I need to change?


It seems that HHVM simply does not support memcached, even though setting the save handler to "memcached" results in no errors or warning messages (whereas memcache is reported as unrecognised).

This is unfortunate, but I found HHVM's stability to be poor when unable to precompile all of my scripts, so I've switched to PHP 7 instead anyway. PHP 7 doesn't have memcached support yet either, but it will hopefully be restored soon.

  • What is your reference showing that HHVM does not support memcached? etsy is using hhvm with memcached (noting issues with memcached) codeascraft.com/2015/04/06/experimenting-with-hhvm-at-etsy – Walt Sorensen May 10 '16 at 15:12
  • From that article it sounds like Etsy had to compile their own memcache extension for HHVM due to numerous issues; at the time I posted my answer the issues with memcache still don't appear to be fixed, even though memcache gives the appearance of being supported in HHVM, it wasn't reliable at all. – Haravikk May 14 '16 at 6:36
  • I'll have to look at this again when HHVM 3.14 or 3.15 comes out. 3.13 is busted for compiling your own extensions – Walt Sorensen May 18 '16 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.