5
를 연결하는 나는 PHP와 스크립트 이미지를 처리 할 수의 nginx와 CSS를memcache에 - 수없는
내가 설치 한 memcached와 서버를 처리하기 위해 아파치를 사용에 CentOS 6를 실행 해요.
PORT="11211"
USER="memcached"
MAXCONN="4096"
CACHESIZE="512"
OPTIONS="-l 127.0.0.1"
나는 또한 php를위한 모듈을 설치했다.
은 내가$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");
내가 memcached와 상태를 확인 새로운 PHP 파일을 생성하고 실행한다.
"연결하지 못했습니다."라는 메시지가 항상 나타납니다.
'localhost'값을 '127.0.0.1'에서 변경하려고했으나 여전히 작동하지 않습니다.
$memcache = new Memcache();
$memcache->addServer('127.0.0.1', 11211) or die ("Could not connect");
var_dump($memcache->getExtendedStats());
$memcache->set('key', 'hello world', false, 60);
echo $memcache->get('key');
//$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");
출력
array(1) { ["127.0.0.1:11211"]=> bool(false) }
무엇을 연결하고 addServer 다르게합니까? 가장 좋은 방법은 무엇입니까?
하지만 난 코드에이 문제에 안녕하세요
더 많은 업데이트를 받고 있지 않다 ..
은 phpinfo는 memcached를을 보이고있다.
var_dump ($ memcache-> get ('key'));
bool(false)왜 내가 대신 의 addServer를 사용해야합니다
연결 준다? 코드에
더 많은 업데이 트
$memcache = new Memcache;
$memcache->addServer('localhost', 11211);
echo $memcache->getServerStatus('localhost', 11211);
output : 1
//$memcache->set('key', 'hello world') or die("failed to store data");
output : failed to store data
몇 자세한 내용
getsebool httpd_can_network_memcache
그것은에 반환해야
오프 반환?
Notice: Memcache::connect(): Server 127.0.0.1 (tcp 11211, udp 0) failed with: Permission denied (13)
"telnet 127.0.0.1 11211" – fsw
예, 시도 했습니까? 나는 연결 됐어. 이스케이프 문자는 ... –
코드를 실행하려고 시도하는 동일한 서버에서 memcache 데몬이 실행되고 있습니까? –