SnapOverflow

SnapOverflow Logo SnapOverflow Logo

SnapOverflow Navigation

  • Home
  • Server
  • Ubuntu

Mobile menu

Close
  • Home
  • System Administrators
    • Hot Questions
    • New Questions
    • Tags
  • Ubuntu
    • Hot Questions
    • New Questions
    • Tags
  • Help
Home / server / Questions / 286381
Accepted
MacMac
MacMac
Asked: 2011-07-03 02:37:59 +0800 CST2011-07-03 02:37:59 +0800 CST 2011-07-03 02:37:59 +0800 CST

Memcached problems "failed to listen on TCP port 11211"

  • 772

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?

memcached
  • 3 3 Answers
  • 24610 Views

3 Answers

  • Voted
  1. Best Answer
    Conor McDermottroe
    2011-07-03T04:50:48+08:002011-07-03T04:50:48+08:00

    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.

    • 5
  2. Tony Topper
    2013-02-12T07:58:18+08:002013-02-12T07:58:18+08:00

    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"
    
    • 0
  3. Alex Clay
    2017-02-25T09:29:18+08:002017-02-25T09:29:18+08:00

    I also ran into the first error you reported:

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

    In my configuration I found the error was caused by multiple -l arguments to the same address. On Ubuntu my /etc/memcached.conf file contained:

    -l localhost
    -l 127.0.0.1
    

    memcached was able to successfully bind to the first address, but because 127.0.0.1 duplicates localhost, memcached gave the Address already in use error when it tried to bind to the second address.

    If you're running into this error and can't find an existing process binding to your port, double-check your memcached configuration. If you're listening for connections on multiple addresses, ensure those addresses don't represent the same address. Such a setup could cause this error.

    • 0

Sidebar

Stats

  • Questions 681609
  • Answers 979841
  • Best Answers 279908
  • Users 287144
  • Popular
  • Answers
  • Marko Smith

    Ping a Specific Port

    • 18 Answers
  • Marko Smith

    Check if port is open or closed on a Linux server?

    • 7 Answers
  • Marko Smith

    How to automate SSH login with password?

    • 10 Answers
  • Marko Smith

    How do I tell Git for Windows where to find my private RSA key?

    • 30 Answers
  • Marko Smith

    What's the default superuser username/password for postgres after a new install?

    • 5 Answers
  • Marko Smith

    What port does SFTP use?

    • 6 Answers
  • Marko Smith

    Resolve host name from IP address

    • 8 Answers
  • Marko Smith

    Command line to list users in a Windows Active Directory group?

    • 9 Answers
  • Marko Smith

    What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats?

    • 3 Answers
  • Marko Smith

    How to determine if a bash variable is empty?

    • 15 Answers
  • Martin Hope
    Davie Ping a Specific Port 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    Smudge Our security auditor is an idiot. How do I give him the information he wants? 2011-07-23 14:44:34 +0800 CST
  • Martin Hope
    kernel Can scp copy directories recursively? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh returns "Bad owner or permissions on ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil How to automate SSH login with password? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin How do I deal with a compromised server? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner How can I sort du -h output by size 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent How to determine if a bash variable is empty? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus How do you find what process is holding a file open in Windows? 2009-05-01 16:47:16 +0800 CST

Related Questions

Trending Tags

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Home
  • Questions
    • Hot Questions
    • New Questions
  • Tags
  • Help

Footer

SnapOverflow

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Help

© 2022 SOF-TR. All Rights Reserve