PHP configuration to enable sessions
On our development server, sessions handling works fine. On our production server, it doesnt.
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 on the production server shows:
session
Session Support enabled
Registered save handlers files user
Registered serializer handlers开发者_如何学编程 php php_binary wddx
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
Can the absence of the "mm sqlite" stop PHP sessions from working when shifting from development to production?
Taken from http://devzone.zend.com/article/141
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 Optionally, 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 For 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.
Note: the link in the above tutorial is outdated. You can retrieve the mm module from the OSSP.org website.
What does the rest of the 'sessions' settings look like on your phpinfo page?
Particularly, what is the value of "session.save_handler" and "session.save_path"?
Here is some more information: http://php.net/manual/en/session.configuration.php
"mm" and "sqlite" are alternative save handlers available for you to use. By default, php uses "files" which will store session data on your local server.
精彩评论