I'm rather new to Unix and am trying to set up a memcached server on Rackspace Cloud Servers with CentOS 5.4. I've been following the guide below.


I think I have everything set up, but it looks like im missing something. When I run "top" the memcached process is there. But when I try to connect to the server from PHP i get the following error.

Memcache::connect() [<a href='memcache.connect'>memcache.connect</a>]: Can't connect to, A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.(10060)

I am connecting from a different server and I'm using the memcached server IP and port.

Here is the string I used to run memcached.

/usr/local/bin/memcached -d -m 200 -p 11211 -c 20480 -u root

I set a different port than that, but I want to keep it secret ;)

Any thoughts on what I did wrong, or some ideas on how I can test/troubleshoot the server? Or any pointers in general for a total noob like me?

Thanks in advance!


Would this "secret" port be the 23232 seen in your error message?

memcached runs over a plain,cleartext tcp connection.

try telneting to your memcached server and issuing the stats command like so:

justin@bert ~ % telnet lois 11211
Trying .....
Connected to lois...
Escape character is '^]'.
STAT pid 3174
STAT uptime 665105

get that to work first, then get php to work with it.

also, since memcached uses a cleartext protocol with no encryption, it is not something you want running on an internet facing server.

  • doh! that is the port of course. ill give telnet a try shortly and see how it goes – Pepper Mar 4 '10 at 3:01
  • Looks like it working through telnet. Anything specific I should be looking for in the response? telnet 11211 Trying Connected to Escape character is '^]'. stats STAT pid 1070 STAT uptime 5686 STAT time 1267671846 – Pepper Mar 4 '10 at 3:09
  • ah, I get it. I ran some set and get commands while connected through telnet. It seems to be working from there. Could this be a firewall configuration issue or something? – Pepper Mar 4 '10 at 3:30
  • If it was a firewall configuration issue you would not be able to telnet to the server and run the stats command. – Justin Mar 4 '10 at 4:56

I found the answer here.


Needed to allow the port in iptables. If someone else has this issue, make sure to read the comment on that post. The entry needs to be added before the second last line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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