我使用 nginx 1.2.3(php-fpm)php 5.4.7 pecl memcached 2.1.0 memcached 1.4.15
如果 memcached 服务停止或获取未找到的密钥,nginx 将返回 502 错误,并且错误日志我懂了:
2013/11/19 17:37:04 [error] 3972#0: *554345 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x , server: www.site.com, request: "GET /test/mk.php?get=var1 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.site.com"
php-fpm.log说:
[19-Nov-2013 17:58:32] WARNING: [pool www] child 4626 exited with code 127 after 18.892556 seconds from start
[19-Nov-2013 17:58:32] NOTICE: [pool www] child 4641 started
有谁能够帮助我?
答案1
ngnix 错误意味着 www.site.com/test/mk.php?get=var1 没有回复 http 请求。
尝试直接调用 www.site.com/test/mk.php?get=var1,不使用 nginx,查看实际返回的内容。
答案2
我将 libmemcached 更新至 1.0.17,但无法编译 pecl memcached 2.1 https://github.com/php-memcached-dev/php-memcached/issues/69 我安装了 libmemcached 1.0.16 并安装了 pecl memcached,我的主要问题就解决了。