Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 3 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 http://pecl.php.net/package/memcache 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

OPTIONS="-l 127.0.0.1"
share|improve this answer

Your Answer

 
discard

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.