使用Amazon Linux在AWS上使用php 5.4运行应用程序。未将PHP会话保存在memcache中
PHP版本是PHP 5.4.28。从AWS回购安装 内存缓存LIB是php54-PECL,内存缓存,3.0.8-1.11.amzn1.x86_64
我已经验证,PHP是使用/etc/php.ini中:
[[email protected]]# php -i | grep Config
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
的设置,我应该使用的memcache显示:
[[email protected] etc]# grep "^session.save" php.ini
session.save_handler="memcache"
session.save_path="tcp://<elasticache-endpoint>:11211"
[[email protected] php.d]# php -i | grep session.save
session.save_handler => memcache => memcache
session.save_path => tcp://<elasicache-endpoint>:11211?persistent=1&weight=1&timeout=1&retry_interval=15 => tcp://<elasticache-endpoint>:11211?persistent=1&weight=1&timeout=1&retry_interval=15
我可以从包装盒到终点&端口Telnet和正确连接,所以实例是能够连接到memcached服务器。
的事情,我们曾尝试:
- 我已删除了TCP://从php.ini文件,并没有什么区别 - 会话仍然得到保存在文件中。
- 我们从session.save_handler =“内存缓存”改为session.save_handler =“分布式缓存”每次我们作出改变时
- ,我们停止在httpd服务器,然后再启动它
- 我们甚至试图重新启动服务器
无论我们尝试过什么,会话都会存储在磁盘上/ var/lib/php/sessions。 有什么我很想念,或者这是一个已知的5.4或AWS问题?
你可以尝试'memcached'作为处理程序而不是'memcache'吗? – DanFromGermany
@DanFromGermany:不,这是遗留代码,并为db缓存使用memcache。 – chris
PHP 5.4.29不是传统。只需安装memcached模块并尝试一下。反正它不会影响你的PHP代码。顺便说一句,你重新启动PHP(无论是网络服务器,如果它是一个模块,或者fpm,如果它是fcgi)? – DanFromGermany