Sessions, Paths in PHP 5

He has: 14 posts

Joined: Sep 2005

Hi everyone,

I have a question re: working with sessions in PHP 5.

I am aware that a call to

<?php
session_start
();
?>
is required before I'm able to manipulate SESSION variables.
This works perfectly under PHP 4.*

Problem: In PHP 5, I run into access problems with the default tmp path (Access Denied, etc)

After some googling, I found that in PHP 5, I have to manually set the session.save.path variable with this:

<?php
session_save_path
('/abs_dir_to_my_home/custom_tmp_path');
?>

My question: Is there a better way to do this? Because now the session entries are saved in a directory on my webspace and I have to manually clean it up once in a while.

I have a funny feeling that I'm running around in circles when there is a much simpler way.

Can anyone help me? Thanks!

Busy's picture

He has: 6,151 posts

Joined: May 2001

I haven't used much PHP5 but the idea of a session is for a session only and should be destoryed (automatically) at the end of the session - when browser is closed or session timed out. If the sessions do not expire then that can be a major security issue.

check out
http://www.phpbuilder.com/board/archive/index.php/t-10285731.html
and
http://php.net/session

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.