简体   繁体   中英

Why PHP Sessions Memcached works but Memcache doesn't?

I'm trying to figure out what's wrong for hours,

<?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";
?>

Will print but if it's "memcache" notice the "d" it will not work + fire the error in 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 set as following:

session.save_path = "/var/lib/php/session"
session.save_handler = files

error in 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

Try some thing like this :

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');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM