Php-Fpm

PHP-FPM 在 memcached 中保存會話

  • August 31, 2018

我正在嘗試將我的 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():

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

有人可以引導我進行正確的配置嗎?

不工作:

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

工作過:

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

添加了引號,刪除了協議

引用自:https://serverfault.com/questions/575299