[PHP] default php sessions in a database

2003-02-11 Thread Robin Mordasiewicz
Is there a way to configure php to use a database for sessions rather than
a text file.
I have a server farm and want the session files to be accessible to all
machines in the cluster. I can have the session file on nfs but I am
worried  about file locking.
I have read tutorials on how to set session.save_handler = user and then
each script configures their seesion variables and connections, but I
want this to be transparant to my users. I do not want users to have to
change anything in their scripts.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] default php sessions in a database

2003-02-11 Thread Tom Rogers
Hi,

Wednesday, February 12, 2003, 1:34:49 PM, you wrote:
RM Is there a way to configure php to use a database for sessions rather than
RM a text file.
RM I have a server farm and want the session files to be accessible to all
RM machines in the cluster. I can have the session file on nfs but I am
RM worried  about file locking.
RM I have read tutorials on how to set session.save_handler = user and then
RM each script configures their seesion variables and connections, but I
RM want this to be transparant to my users. I do not want users to have to
RM change anything in their scripts.

Have a look at msession, it was built for your situation.

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] default php sessions in a database

2003-02-11 Thread Chris Wesley
On Tue, 11 Feb 2003, Robin Mordasiewicz wrote:

 Is there a way to configure php to use a database for sessions rather than
 a text file.
 I have a server farm and want the session files to be accessible to all
 machines in the cluster. I can have the session file on nfs but I am
 worried  about file locking.
 I have read tutorials on how to set session.save_handler = user and then
 each script configures their seesion variables and connections, but I
 want this to be transparant to my users. I do not want users to have to
 change anything in their scripts.

Consider this (Warning: I haven't tried this, yet):

Write your session handling functions and put them in a file ... say,
/var/www/server/custom_session.php.  Call session_set_save_handler() with
your function names as arguments in that file.
(Good explanations here:
 http://www.php.net/manual/en/function.session-set-save-handler.php)

In your php.ini file, set:
session.save_handler = user
auto_prepend_file = /var/www/server/custom_session.php

This will cause PHP to use your custom session handler system-wide,
while remaining transparent to your users, I believe.  (If anyone knows
this to be not the case, let me know.)

Caveats:

You'd have to make sure you custom handler function names are unique
enough so as to not conflict with functions names your users can create.

I'm not sure what will happen if your users call
session_set_save_handeler() again, but with their own functions as
handlers.

If after some consideration it still seems like a workable solution and
you try it, let us know how it pans out!

g.luck,
~Chris




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Sessions in a database?

2002-08-13 Thread Randy Johnson

When i started to learn php there was talk of storing session information in
a database rather than in a particular directory like /tmp

Is it better to store the session data in a database rather than a
directory?   Is it faster if it is stored in the database?

Randy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Sessions in a database?

2002-08-13 Thread Rasmus Lerdorf

The main reason to store it in a database is to allow you to share that
session data across multiple web servers.  In a load-balanced
architecture, this is essential.

-Rasmus

On Tue, 13 Aug 2002, Randy Johnson wrote:

 When i started to learn php there was talk of storing session information in
 a database rather than in a particular directory like /tmp

 Is it better to store the session data in a database rather than a
 directory?   Is it faster if it is stored in the database?

 Randy



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php