what is a connection refused(111) error?

21063 views
Skip to first unread message

pedalpete

unread,
Sep 5, 2008, 2:47:08 PM9/5/08
to memcached
I've tried reinstalling memcache a few times, and I can connect to it
from root, but when attempting to connect via my php page, I get a
[code]
Memcache::connect() [memcache.connect]: Server 127.0.0.1 (tcp 11211)
failed with: Connection refused (111)
[/code]

I have tried using 'localhost' as the server which works on my dev
machine, but not on testing or prod.

I can't seem to find what this error means.
Anybody know?

Steve Yen

unread,
Sep 5, 2008, 4:01:24 PM9/5/08
to memc...@googlegroups.com
Could be any number of things...

111 is just the ECONNREFUSED error code value from underlying socket
connect() syscall.

Apologies if you've tried or thought of these top-of-head ideas already...
a - is memcached really running? on port 11211?
b - can you telnet to it? can you telnet as the same user as your
websvr/php, on the same box?
c - if a is yes and b is no, you might have weird firewall rules?

pedalpete

unread,
Sep 5, 2008, 4:54:57 PM9/5/08
to memcached
Thanks Steve,

I am kinda new to admining my own server, so no, I hadn't tried
telnet.
And you are correct, I can't telnet to 11211.
But at the same time, I can't be sure that memcached is running
either. I'm not sure how to test for that.
I have started memcached with
[code]
memcached -d -m 1024 -l 10.0.0.40 -p 11211 -u nobody
[/code]

and I get returned to the command line. it doesn't say if it is
actually running or not, but I assumed without errors that it was
running.

when I look through ps aux | less, I don't see an entry for Memcache,
so I'm guessing that maybe memcache isn't running? or would it not
show up in running processes?

Sorry I'm at a bit of a loss here, I'm surprised memcached doesn't
return an error if it can't start or something.



On Sep 5, 1:01 pm, "Steve Yen" <steve....@gmail.com> wrote:
> Could be any number of things...
>
> 111 is just the ECONNREFUSED error code value from underlying socket
> connect() syscall.
>
> Apologies if you've tried or thought of these top-of-head ideas already...
> a - is memcached really running?  on port 11211?
> b - can you telnet to it?  can you telnet as the same user as your
> websvr/php, on the same box?
> c - if a is yes and b is no, you might have weird firewall rules?
>

Jehiah Czebotar

unread,
Sep 5, 2008, 5:52:07 PM9/5/08
to memc...@googlegroups.com, pedalpete
> I have started memcached with
> [code]
> memcached -d -m 1024 -l 10.0.0.40 -p 11211 -u nobody
> [/code]

and your error is

> [code]
> Memcache::connect() [memcache.connect]: Server 127.0.0.1 (tcp 11211)
> failed with: Connection refused (111)
> [/code]

so already there is a problem. you have the server listening on
10.0.0.40 and you are trying to connect to 127.0.0.1. If you have a
specific address you are listening on you need to use that in your php
code to connect to, or if you mean to listen on all addresses use -l
0.0.0.0

this of course still doesn't help resolve weather or not you have
memcached running.

--
Jehiah

dormando

unread,
Sep 5, 2008, 6:00:37 PM9/5/08
to memcached
Hey,

When you're getting started with memcached, it might be a good idea to
start it without the -d option the first time. We daemonize really early
(maybe this is fixable...) so a startup error isn't always printed when
you use -d.

By removing the daemonize option it'll run in the foreground. So you can
see why it doesn't start, but you'll have to remember to restart it with
-d once you're sure it works.

-Dormando

pedalpete

unread,
Sep 5, 2008, 6:01:13 PM9/5/08
to memcached
Thanks Jehiah,
You are correct. I'm not sure why all the online guides said
'10.0.0.40', and in the past I had tried with 127.0.0.1, but didn't
get very far.

pedalpete

unread,
Sep 5, 2008, 6:04:50 PM9/5/08
to memcached
SUCCESSS!!!! thank you all so much for the help.


So i went back to starting with -d. The problem now is that when I
cancel out of the command line

Benya Benya

unread,
Jul 18, 2020, 2:14:06 PM7/18/20
to memcached
google.com refused to connect.
Reply all
Reply to author
Forward
0 new messages