Memcache issue

I am using PHP to connect to memcache.

I connect memcache service in the PHP code as follows:
$memcache = new Memcache;
$memcache->connect(‘’, 11211); //connect to memcached server

Then when I connect to NGX server, I got 500 or 502 error.

However, if I run the memcache using php test.php directly, I can
connect to memcache server successfully.

I am using php-fpm.

Does anyone encounter the similar issue before?


What is in error_log ?

Igor S.

05.05.2011, 19:52, “Yanxin Z.” [email protected] ():

Thank you for your help, Igor.

The log is

1815426 2011/05/05 09:05:09 [notice] 13424#0: 15
)/upload_internal" matches “/api/1.0/
web/upload_internal”, client:, server: localhost, request:
“POST /api/1.0/web/upload_internal HTTP/1.1”, host: “”
1815427 2011/05/05 09:05:09 [notice] 13424#0: *15 rewritten data:
“/api/1.0/web/upload.php”, args: “”, client:, server:
localhost, request: “POST /api/1.0/web/upload_internal HTTP/1.1”,
host: “”
1815428 2011/05/05 09:05:09 [error] 13424#0: *15 recv() failed (104:
Connection reset by peer) while reading response header from upstream,
client:, server: localhost, request: “POST /
api/1.0/web/upload_internal HTTP/1.1”, upstream:
“fastcgi://”, host: “”
1815429 2011/05/05 09:05:09 [info] 13424#0: *15 client closed
keepalive connection

Hello Igor,
Thank you for your direction.

I searched for “nginx 104: Connection reset by peer”

In the forum

Someone suggest to restart fastcgi.

I did restart php-fpm then, memcached is working now.

Hopefully my post is helpful to other members.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs