php session's

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

php session's

Post by pelegk2 »

i have noticed that in PHP the session is save in the HD under the user temp folder (on winXP at least)!

is this always?or it depends the apache configuration?

and if so why when the sessions end's the session fiels arent deleted???
beacuse its a security matter!

thnaks in advance
peleg
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Re: php session's

Post by Buddha443556 »

pelegk2 wrote:i have noticed that in PHP the session is save in the HD under the user temp folder (on winXP at least)!
You can set a different location using session.save_path directive.
pelegk2 wrote:is this always?or it depends the apache configuration?
/tmp on the HD is the default. As I said above you can change that location usually. You could also use shared memory not available on Windows though.
pelegk2 wrote:and if so why when the sessions end's the session fiels arent deleted???
beacuse its a security matter!
Old session are deleted during garbage collection. You may want to play with these configuration options session.gc_probability, session.gc_divisor and session.gc_maxlifetime.

One more thing:
THE MANUAL wrote:Note: If you are using the default file-based session handler, your filesystem must keep track of access times (atime). Windows FAT does not so you will have to come up with another way to handle garbage collecting your session if you are stuck with a FAT filesystem or any other fs where atime tracking is not available. Since PHP 4.2.3 it has used mtime (modified date) instead of atime. So, you won't have problems with filesystems where atime tracking is not available.
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

what i meant :

Post by pelegk2 »

u wrote :
As I said above you can change that location usually. You could also use shared memory not available on Windows though.
what i meant was if or how can i make php not to use files for session but only the memory?
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

OSSP mm by Ralf S. Engelschall.
THE README from mm wrote:OSSP mm is a 2-layer abstraction library which simplifies the usage of shared memory between forked (and this way strongly related) processes under Unix platforms. On the first (lower) layer it hides all platform dependent implementation details (allocation and locking) when dealing with shared memory segments and on the second (higher) layer it provides a high-level malloc(3)-style API for a convenient and well known way to work with data-structures inside those shared memory segments.

This library was successfully tested on FreeBSD, OpenBSD, NetBSD, BSDI, Linux, SunOS, Solaris, Tru64, AIX, A/UX, HP-UX, ReliantUNIX, IRIX, UnixWare and even Win32 Cygwin, BeOS and OS/390.
THE MANUAL- shmop wrote:Note: Versions of Windows previous to Windows 2000 do not support shared memory. Under Windows, Shmop will only work when PHP is running as a web server module, such as Apache or IIS (CLI and CGI will not work).
You might try writing a custom session handler using shmop might work on XP.

Might look at Class: shmem.
Post Reply