Warning: is_writable(): Unable to find the wrapper “tcp” – Magento, Memcached and Sessions

Recently had an issue on a production Magento instance where I was finding the following warning output to system.log on every page hit

Warning: is_writable(): Unable to find the wrapper "tcp"

I couldn’t find anyone else who’d encountered this same issue so here are my findings:

It transpired that session data was being saved in files (this is default for Magento) in the /tmp/ directory of the filesystem. At first I couldn’t work out why on earth this would be happening as I though I’d set up Magento to use memcached, so why would sessions be saving to files?

Well, once looking in /app/etc/local.xml, it turned out the node was present with memcached connection details (tcp://127.0.0.1:11211 etc) but the node was missing.

The result was that Magento was defaulting to the file session save method and passing a path with tcp:// handle to the is_writable() method. This obviously was returning false and so Magento was writing session data to it’s fallback location in the /tmp/ directory and outputting a log entry that the “tcp” wrapper (tcp://) couldn’t be found

This is was a bit of silly human error but hopefully if anybody ever has this issue they’ll find this info!

comments powered by Disqus