@tuxx

Сессии в Memcached?

Перенес сессии в memcached. Соединяюсь через сокет. В htaccess такие настройки:
php_value session.save_handler memcached
php_value session.save_path '/var/www/project/tmp/memcached.sock'

Файл сокета создается. На папку и сам файл пока права 777.

Memcached запускается вот так:
/usr/bin/memcached -v -u $username -s ${TMP_PATH}/memcached.sock -a 777 -P ${TMP_PATH}/memcached.pid -m 64 -I 1024 -d

Вариант с соединением через порт не рассматривается.

Временами ругается в логи. И в этот момент сессия может поломаться.
[19-Nov-2018 13:14:48 Europe/Moscow] PHP Warning:  session_start(): Unable to clear session lock record in /var/www/project/vendor/<my-packet>/helpers/SessionHelper.php on line 27
[19-Nov-2018 13:14:48 Europe/Moscow] PHP Warning:  session_start(): Failed to read session data: memcached (path: /var/www/project/tmp/memcached.sock) in /var/www/project/vendor/<my-packet>/helpers/SessionHelper.php on line 27
[19-Nov-2018 13:14:48 Europe/Moscow] PHP Warning:  session_start(): Unable to clear session lock record in /var/www/project/vendor/<my-packet>/helpers/SessionHelper.php on line 27
[19-Nov-2018 13:14:48 Europe/Moscow] PHP Warning:  session_start(): Failed to read session data: memcached (path: /var/www/project/tmp/memcached.sock) in /var/www/project/vendor/<my-packet>/helpers/SessionHelper.php on line 27
[19-Nov-2018 13:14:53 Europe/Moscow] PHP Warning:  Unknown: using touch command with binary protocol is not recommended with libmemcached versions below 1.0.18, please use ascii protocol or upgrade libmemcached in Unknown on line 0
[19-Nov-2018 13:14:58 Europe/Moscow] PHP Warning:  Unknown: using touch command with binary protocol is not recommended with libmemcached versions below 1.0.18, please use ascii protocol or upgrade libmemcached in Unknown on line 0


Настройки memcached в php 7.1.23 такие (кроме настроек htaccess, которые выше):
igbinary session support => yes
session.auto_start => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => Off => Off
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.gc_divisor => 1000 => 1000
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.lazy_write => Off => Off
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => memcached => memcached
session.save_path => /var/www/project/tmp/memcached.sock => /var/www/project/tmp/memcached.sock
session.serialize_handler => php => php
session.sid_bits_per_character => 4 => 4
session.sid_length => 32 => 32
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_strict_mode => Off => Off
session.use_trans_sid => 0 => 0
session.trans_sid_hosts => no value => no value
session.trans_sid_tags => a=href,area=href,frame=src,form= => a=href,area=href,frame=src,form=
  • Вопрос задан
  • 1059 просмотров
Пригласить эксперта
Ответы на вопрос 1
Stalker_RED
@Stalker_RED
В php.ini
session.save_handler="memcached"
session.save_path="/foo/bar/memcached.sock"

А helpers/SessionHelper.php - выбросить.

Ну или показывайте что там внутри.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы