Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed memcached on my Mac OS X 10.6.8. It installed perfectly and when I type in memcached in Terminal I get this:

failed to listen on TCP port 11211 tcp
listen: Address already in use

And I have a script in my localhost that contains this:

$memcache = new Memcache();

But I get an error thrown saying Fatal error: Class 'Memcache' not found.

How can I get memcached to work, is it because the port 11211 is not listened to which probably doesn't make memcached work?

share|improve this question
Don't go on chat to 'bump' up 5 minute old questions, things don't work that way, it'll just annoy other users who won't want to help you. – Chopper3 Jul 2 '11 at 12:47
I apologise for that. – MacMac Jul 2 '11 at 16:03
up vote 5 down vote accepted

Your first error is probably because memcached is already running. If you run ps -e | grep memcache | grep -v grep you'll probably see it. The output of netstat -a -p tcp | grep LISTEN will show you all the listening services too, which may help.

The second issue is probably because you don't have a memcache extension installed for your version of PHP (from the error I'm assuming you're using PHP). You probably want to solve that.

share|improve this answer

Memcache could already be running. I had a crashed version of memcache running and got this problem.

I found this helpful:

netstat -l --protocol=tcpip --program

Once I had the pid I killed memcache

I then edited the config

vi /etc/sysconfig/memcached

I added

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.