Failed to write session data, php and memcached

百般思念 提交于 2019-12-05 01:03:18
craigtadlock

If you are using memcache then save_path must have the tcp:// prefix.

If you are using memcached then the save_path should not have the tcp:// prefix.

The answer is Memcached objects can be maximum of 1MB (default)

if your array or object exceeds this limit, the object will be removed magically :)

All the items in your session will be removed, just saying this because right now at this moment I have experienced it my self

I solved it by starting the Memcached Session server like this

memcached -I 10m

I believe it is something to do with using the memcached extension and it not initializing before the sessions. I switched to using the memcache extension rather than the memcached extension and it works.

session.save_handler = memcache
session.save_path="tcp://192.168.1.103:11211"

I had a similar issue with symfony2 and memcached on a docker-compose stack.

The error stated:

Warning: Failed to write session data (user). Please verify that the current setting of session.save_path is correct

And the problem was that I had an outdated ./app/config/parameters.yml

Check your memchached setting to fit your needs, e.g.:

parameters:
    session_memcached.host: '%session_memcached_host%'
    session_memcached.port: '%session_memcached_port%'
    session_memcached.prefix: '%session_memcached_prefix%'
    session_memcached.expire: '%session_memcached_expire%'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!