PHP-FPM 在 memcached 中保存会话

PHP-FPM 在 memcached 中保存会话

我正在尝试将 session_handler 切换到 memcached,我不确定它是否有效,看起来似乎没有。

vi /etc/php5/fpm/php.ini

session.save_handler = memcached
session.save_path = unix://run/memcached/memcached.sock

/etc/init.d/php5-fpm restart

在访问过我的博客几次之后,我应该在 memcached 中有一个密钥,不是吗?

nc -U /run/memcached/memcached.sock

giant:~# nc -U /run/memcached/memcached.sock
stats items
END
stats slabs
STAT active_slabs 0
STAT total_malloced 0
END

phpinfo():查看phpinfo()函数

session.gc_probability  0   0
session.hash_bits_per_character 5   5
session.hash_function   0   0
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    memcache    memcache
session.save_path   unix://run/memcached/memcached.sock unix://run/memcached/memcached.sock
session.serialize_handler   php php
session.upload_progress.cleanup On  On
session.upload_progress.enabled On  On
session.upload_progress.freq    1%  1%
session.upload_progress.min_freq    1   1
session.upload_progress.name    PHP_SESSION_UPLOAD_PROGRESS PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix  upload_progress_    upload_progress_
session.use_cookies On  On
session.use_only_cookies    On  On
session.use_trans_sid   0   0

有人可以告诉我正确的配置吗?

答案1

不工作:

session.save_path = unix://run/memcached/memcached.sock

做过的工作:

session.save_path = "/run/memcached/memcached.sock"

添加引文,删除协议

相关内容