Monday, July 2, 2012

Manage php sessions with memcached

apt-get install memcached libmemcached-dev php5-memcached php5-memcache



Change your php.ini to use memcache for session storage:
[Session] 
; Handler used to store/retrieve data. 
session.save_handler = memcache

; Argument passed to save_handler.  In the case of files, this is the path 
; where data files are stored. Note: Windows users have to change this 
; variable in order to use PHP's session functions. 
session.save_path = "tcp://127.0.0.1:11211"
Restart your apache or cgid and you're done.