PHP: session_set_save_handler: first parameter: what to set the save path to?

Hello Experts,

the session_set_save_handler has 6 parameters. the first one, Open, expects two parameters, where the first is the save path and the second is the session name.

What do most programmers set this save_path to?
In other words, what do I set this to?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Isn't that parameter sent to your function from php?
You are trying to make your own custom session handler, correct? You aren't simply just trying to use sessions, you want to invent your own wheel?

if so, in other words, you simply set up your custom session like this:
function open($path, $name) {
  global $session_path;
  $session_path = $path;
session_set_save_handler("open", "close", "read", "write", "destroy", "gc");

Open in new window

When your "open" function is called, php will send you the save path. That save path is set in php config and doesn't need to be messed with

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
epifanio67Author Commented:
thank you experts...


on your example above, the method Open, I still don't see what $path is set to?

do I have to specify a directory on the server? example

$path = '/sessions';

or is there a default?

see what I mean?

thanks so much for your help..
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Depending on the type of server you're running it can vary. To locate the directory, search for the following in your php.ini file.

upload_tmp_dir = "/tmp"

The directory can be different for you.
epifanio67Author Commented:
thank you expert,

but I don't have to set $path to any directory... the variable $path is set at the php.ini file, correct?

sorry, I just want to make sure I understand...

thanks again...  

epifanio67Author Commented:
I got it... thank you experts..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.