Upgrading php5-memcache on Ubuntu (Intrepid)

We were having a little problem on our webservers with php5-memcache when we try to utilize multiple memcached servers. The error was:
ALERT – canary mismatch on efree() – heap overflow detected (attacker ’10.X.X.X’, file ‘/path/to/file/index.php’)
It didn’t come up too frequently in the logs, but it was frequent enough to cause some concern.

As part of troubleshooting, I was tasked with upgrading php5-memcache on one of our test systems so that we could see if this resolved the issue. This turned out to be much easier than I thought. Here’s what I did (as root):

apt-get install php5-dev
cp /usr/lib/php5/20060613+lfs/memcache.so /usr/lib/php5/20060613+lfs/memcache.so.bak
pecl install memcache-3.0.3
/etc/init.d/apache2 restart

That was it, we’re running on 3.0.3 now and I’m crossing my fingers that resolves the issue we’re seeing.