问题描述
在我们的开发服务器上,会话处理可以正常工作.在我们的生产服务器上,没有.
On our development server, sessions handling works fine. On our production server, it doesnt.
phpinfo显示:
phpinfo on the development server shows:
session
Session Support enabled
Registered save handlers files user mm sqlite
Registered serializer handlers php php_binary wddx
生产服务器上的
phpinfo显示:
phpinfo on the production server shows:
session
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx
什么是"mm sqlite",这可能会引起问题吗?如何启用此功能?这些设置是什么?
What is "mm sqlite" and could it be causing the problem? How do I enable this? What are these settings anyway?
其余设置在两者之间是相同的:
The rest of the settings are common between the two:
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
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.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0
从开发转移到生产时,缺少"mm sqlite"是否可以阻止PHP会话正常工作?
Can the absence of the "mm sqlite" stop PHP sessions from working when shifting from development to production?
推荐答案
来自 http://devzone .zend.com/article/141
有两个内置选项可用于存储会话数据.会话处理程序在php.ini中的名为
There are a couple built-in options for storing session data. The session handler is set in the php.ini under the directive named
session.save_handler
sqlite (可选)您可以将会话数据存储在sqlite数据库中.为此,请使用以下配置:
sqliteOptionally, you can store session data in an sqlite database. To do so, use a configuration such as:
session.save_handler = sqlite
session.save_path = /tmp/phpsess.db
mm 对于高性能会话存储,您可以使用mm共享内存模块将会话数据存储在内存中.您需要使用mm模块支持来编译php.这是使用mm配置会话处理的教程( http://www.zend.com/tips/tips.php?id=164&single=1 ).请注意,由于会话日期存储在RAM中,因此您应该将其视为易失数据,并且由于断电或重新启动而丢失.
mmFor high-performance session storage, you can store session data in memory with the mm shared-memory module. You'll need to compile php with the mm module support. Here is a tutorial to configure session handling with mm ( http://www.zend.com/tips/tips.php?id=164&single=1 ). Note that since session date is stored in RAM, you should consider it volatile data, and it's lost with power outage or a reboot.
注意:以上教程中的链接已过时.您可以从OSSP.org网站上获取mm模块.
Note: the link in the above tutorial is outdated. You can retrieve the mm module from the OSSP.org website.
这篇关于PHP配置以启用会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!