★ wanayoo — archive 1999 http://www.php.net/manual/function.session-module-name.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Sessions
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
Sessions
* session_start
* session_destroy
* session_name
* session_module_name
* session_save_path
* session_id
* session_register
* session_unregister
* session_unset
* session_is_registered
* session_get_cookie_params
* session_set_cookie_params
* session_decode
* session_encode
Manual: session_module_name
View the source code for this pageSearch the site



Previous page
 session_name
 Updated
Sat, 12 Aug 2000
session_save_path 
Next page


session_module_name

(PHP4 )

session_module_name -- Get and/or set the current session module

Description

string session_module_name ([string module])

session_module_name() returns the name of the current session module. If module is specified, that module will be used instead.

Note: This function was added in PHP 4.0.


User Contributed Notes: session_module_name


plato151@yahoo.com
12-Nov-1999 05:37
could someone explain what this function exactly do? thanks...


vasquezj@lilly.com
24-Nov-1999 04:31
I would assume this is in place for future expansion. This function returns 'files' with 4.0b3. Perhaps there will be an option to store session data in a database, or some other storage (Cold Fusion lets you store session data in files, any supported DB, or in the registry on WinNT)


plato151@yahoo.com
25-Nov-1999 06:39
It seems that beta 3 now supports session data storage in a database (?)


grid@ucsd.edu
17-Jul-2000 06:37
i believe the three modules currently available are: files, mm, and user. files is for default file session handling. i never looked into mm. user is for db session handling when you redefine the handlers with session_set_save_handlers() ... apparantly db access will not <i>write</i> if you set the session.save_handler to files and attempt to override the handler functions for db access so you need to set session.save_handler to "user". also, if i read correctly, session_module_name() is *supposed* to set the module which you would like to use in your script (thus overriding the php.ini variable session.save_handler) BUT, it doesn't work :/ is this a bug?


kaufmann@cyland.com
20-Jul-2000 11:05
Read http://www.zend.org/zend/tut/session.php...


michael@michaelsmacshack.com
01-Aug-2000 05:38
<pre>First I have read the documentation both on this site and at ZEND.
The test case was taken from the artical "PHP4 Customer Session
Handler Test Script" by Ying Zhang (ying@zippydesign.com) at the
HTTP://www.phpbuilder.com site.

This is a complex issue. It would be reasonable to expect PHP4 to
behave according to what is set in PHP.ini as a default....
The following are my results using PHP4.0.1pl2.

1) With 'session.save_handler' not defined (commented out):

The online documentation for the session_module_name states that
the 'module' can be set in the call:
"session_module_name() returns the name of the current
session module. If module is specified, that module
will be used instead."

Any attempt to do so results in an error regardless of whether
or not any handler has been defined by the user:
Fatal error: Failed to initialize session module in
.../handler/test.php on line 38
This occurs at the session_start() call.

Not setting a 'module' will return the current handler. With
nothing defined in PHP.ini, a value of 'files' is returned.

If you define your 'user' handlers and call 'session_set_save_handler'
before the 'session_module_name' call, a value of user is returned.
However, any variables registered in this session Do Not maintain
their value. It is like the handlers are accepted, but are not used.

Thus, not having 'session.save_handler' defined in PHP.ini does not
help. However, the 'files' modules does work (e.g. no defined user
handlers) in this situation.

2) If we define 'session.save_handler' in PHP.ini with a value of 'files',
then the same results as above occur.

Thus in this case, we have explicitly defined the handler as file and
the only thing that works is the 'files' module.

3) If we define the 'session.save_handler' in PHP.ini with a value of
'user', then things change to the opposite. You must define an
user handler. If you do not, registered variables are not retained.

Thus the 'user' module dos work in this case and the variables are
passed from invocation to invocation.

This leaves us with the following:
a. One handler method can be defined at a time. And only one.
b. There is a very tight coupling between the PHP.ini file and
what can be done by the programmer.

Conclusions. You can get a 'user' handler defined to track the session
data in a database. But, it must be only one way for all applications.
(It could be different databases for different applications however.)
It would seem that this is wrong. It should be reasonable to define one
behavior for one application and another for others.

I hope this has help to clear up a few questions.</pre>



 About Notes


Previous page
 session_name
 Updated
Sat, 12 Aug 2000
session_save_path 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.