1

I have installed the memcache extension and also memcached. Now what do I need to chance in the php.ini file so that all sessions are handled in memcache?

Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148
Peter Johansson
  • 377
  • 1
  • 6
  • 8

1 Answers1

1

Simple answer:

session.save_handler = memcache

and

session.save_path="tcp://server:port"

Long answer, read these pages, and it should explain it a bit better.

Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148
  • about the server:port, any insight of what I should put there? – Peter Johansson Nov 15 '10 at 14:42
  • Should it be "tcp://my.server.com:11211"?? – Peter Johansson Nov 15 '10 at 14:49
  • Google gave me results such as these: session.save_path="udp://:11211?persistent=1&weight=1&timeout=1&retry_interval=15".... do you have an insight of how exactly this works...? – Peter Johansson Nov 15 '10 at 14:51
  • Yep. Or you can use IP Address instead, like "tcp://127.0.0.1:11211" would refer to the memcached server on localhost. – Tom O'Connor Nov 15 '10 at 14:52
  • Excellent. I will go with "tcp://127.0.0.1:11211". Do you have an insight in these type of params: "?persistent=1&weight=1&timeout=1&retry_interval=15"? – Peter Johansson Nov 15 '10 at 14:54
  • I think they're optional, but probably a good idea to shove at the end. I'd always prefer TCP connection to Memcached over an UDP connection, but by all means, I'm sure you can use those parameters too. – Tom O'Connor Nov 15 '10 at 15:03
  • Very well, thank you very much for the support! And if you have the time (mind me being cheeky), as I can clearly see that you are experienced, here: http://serverfault.com/questions/202017/how-to-increase-the-amount-of-memory-memcache-uses – Peter Johansson Nov 15 '10 at 15:06
  • No trouble at all. I Love Memcached, and I'm always happy when people use it. :3 – Tom O'Connor Nov 15 '10 at 15:26