PHP Memcache无法写入会话数据

这个Mathieu

我有两台服务器,正在安装PHP Memcache进行会话。一个工作没有问题,另一个我一直在努力。这些服务器具有相同的php和libs版本,相同的OS(RHEL 6.7),不同的内存大小,不同的磁盘空间,但是我无法缩小问题的范围。

我写了一个小的php文件来创建一个会话并尝试session_write_close()。对于一个系统,我没有错误,并且会话正在使用memcache持久化;对于另一个系统,我得到了以下信息:

Warning: session_write_close(): Failed to write session data (memcache). 
Please verify that the current setting of session.save_path is correct (tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15)

这是我的/etc/php.d/memcache.ini

; ----- Enable memcache extension module 
extension=memcache.so

; ----- Options for the memcache module

;  Whether to transparently failover to other servers on errors
;memcache.allow_failover=1
;  Data will be transferred in chunks of this size
;memcache.chunk_size=32768
;  Autocompress large data
;memcache.compress_threshold=20000
;  The default TCP port number to use when connecting to the memcached server
;memcache.default_port=11211
;  Hash function {crc32, fnv}
;memcache.hash_function=crc32
;  Hash strategy {standard, consistent}
;memcache.hash_strategy=consistent
;  Defines how many servers to try when setting and getting data.
;memcache.max_failover_attempts=20
;  The protocol {ascii, binary} : You need a memcached >= 1.3.0 to use the binary protocol
;  The binary protocol results in less traffic and is more efficient
;memcache.protocol=ascii
;  Redundancy : When enabled the client sends requests to N servers in parallel
;memcache.redundancy=1
;memcache.session_redundancy=2
;  Lock Timeout
;memcache.lock_timeout = 15

; ----- Options to use the memcache session handler

;  Use memcache as a session handler
session.save_handler=memcache
;  Defines a comma separated of server urls to use for session storage
session.save_path="tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15"

这是我的/ etc / sysconfig / memcached

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

同样,在我的两台服务器之间,这些文件是相同的,一台可以工作,而一台则不能。我不确定如何进行调试,因为我收到的唯一错误是其他服务器接受的错误。

这个Mathieu

显然,SELinux中的配置阻止了会话的保存。通过在外壳程序中使用以下命令证明了这一点:

setenforce 0

然后再次测试会话。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

PHP7 + Symfony 2.8,无法写入会话数据

来自分类Dev

从docker nginx / php-fpm安装在本地卷(Mac)上的Laravel无法写入会话文件

来自分类Dev

GAE gcloud dev_appserver.py PHP:无法读取会话数据:用户(路径:Memcache)

来自分类Dev

无法在 Wordpress 中写入会话数据错误

来自分类Dev

在CakePHP中写入会话无法保存

来自分类Dev

PHP会话锁定并使用Memcache存储会话

来自分类Dev

意外值写入会话

来自分类Dev

PHP Memcache延长数据时间

来自分类Dev

PHP 查询非活动分钟数计入会话超时

来自分类Dev

PHP会话无法启动

来自分类Dev

无法使用终端卸载php-memcache

来自分类Dev

PHP会话无法正常工作

来自分类Dev

PHP会话无法正常工作

来自分类Dev

PHP无法设置会话变量

来自分类Dev

PHP会话无法正常工作

来自分类Dev

会话无法正常工作的PHP

来自分类Dev

保存会话数据无效。PHP会话

来自分类Dev

PHP会话数据安全吗?

来自分类Dev

在PHP中传递会话数据

来自分类Dev

在php中写入JSON数据

来自分类Dev

无法在mysql中输入会话变量

来自分类Dev

从JUnit测试将数据注入会话

来自分类Dev

无法在 PHP 中获取和存储会话值到数据库

来自分类Dev

PHP:无法发布数据?

来自分类Dev

在CentOS上使用PHP 7的Memcache扩展无法安装

来自分类Dev

PHP的Memcache扩展-XAMPP Windows无法正常工作

来自分类Dev

PHP - memcache 随机失败 - 无法分配请求的地址 (99)

来自分类Dev

web2py:在python中写入会话变量

来自分类Dev

无法在AJAX调用的php中创建会话