Sorry if I'm off-topic, but I've always wondered what people use sessions for.

I seem to be either dealing with "logged-in" users who I pick up via 
http-authentication and
maintain any details I need in a user data structure, or casual users, for whom the 
odd hidden input
field or occasional cookie seems quite enough. 

I guess I'm also nervous of anything state-full, especially if it makes you dependent 
on
cookies/funny urls/IP addresses etc..

So why do people use sessions?


Alberto Mucignat wrote:
> 
> well, if you're using default session handling provided with php, users
> sessions are stored in /tmp directory (also used by default for temporary
> caching of uploaded files). assume to have the php.ini file with default
> settings:
> 
> session.gc_probability = 1
> session.gc_maxlifetime = 1440
> 
> this means garbage collector lauched 1 times every 100 started sessions.
> furthermore, deletable sessions are those ones opened 1440 seconds ago (24
> minutes).
> 
> well, i've doing some tries asking web server the following by wget command,
> (but i suppose you can use also a sockopen or CURL (!) functions...):
> 
> HEAD /test_session.php HTTP/1.0
> 
> where /test_session.php simply starts a session with "session_start()"
> function. every single request create a session file in the /tmp server
> directory. if someone find out how to do many simultanious requests could
> create so many files in the /tmp dir (while the garbage clean them only after
> 24 minutes).
> 
> we know that linux filesystem is limited to 64K files per directory. this could
> create problems...
> 
> obviously there are some kind of solutions...
> - play with session.gc_* php settings in order to prevent problems (but i
> can't be sure that's a good idea...)
> - provide a different session storage than the default one. in this case, you
> have only two other solutions: mm and database storage. i prefer to store
> sessions in a database, because with mm this could generate worse problems
> with memory usage...
> 
> but i mean... there are so many php developers that uses php with default
> settings (for example: newbies that uses phpnuke or other php content manager
> "session based")...
> 
> about sessions i've found:
> http://www.phpwizard.net/resources/tutorials/session_intro.html
> seen Tobias around? :-)
> 
> bye, alberto.
> 
> ps: well, i work with session since not long time, so can be i made a
> mistake...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to