Tag Archives: memcached

PHP Sessions in Memcache

Putting PHP session files in a single pool can be done using memcached which has the benefit of being faster to look up and no longer relying on a slow filesystem to save session files to (memcached stores its data in memory) but you need to have your developers check that your code won’t have any issues using this over session files.

Install the package and set the configuration file:


Make sure that memcache php plugin is there – or install it

Change this in php.ini

session.save_handler = memcached
session.save_path = "tcp://"

Check memcache stats

echo "stats" | nc 11211
echo "stats" | nc -w 1 11211 | awk '$2 == "bytes" { print $2" "$3 }'