为什么PHP会话Memcached有效但Memcache没有?

时间:2014-06-24 20:18:54

标签: php magento centos memcached

我想弄清楚几个小时的错误,

<?php
ini_set("session.save_handler","memcached");
ini_set("session.save_path","127.0.0.1:11211");

session_start();
print "Session started..\n<br />\n";
?>

会打印,但是如果它是“memcache”注意到“d”它将无效+在php-fpm中触发错误

php -i | grep memcach

memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2
Registered save handlers => files user memcache redis

php.ini设置如下:

session.save_path = "/var/lib/php/session"
session.save_handler = files
php-fpm中的

错误

 PHP Fatal error:  session_start(): Failed to initialize storage module: memcache (path: /var/lib/php/session) in /home/webs/pricegoto.com/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 125

1 个答案:

答案 0 :(得分:1)

尝试这样的事情:

ini_set('session.save_handler', 'memcache');
ini_set('session.save_path',
'tcp://localhost:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15');