This is the very useful function when you want to get or set your session save path. This function takes only one parameter which is option. This function will used to both set and get the session save path.
What is Session Save Path?
Session save path is path to any directory which will be used to save your session values.
Get Session Save Path
To get the current session save path you just need to call this function without passing any parameter just like below code.
[cc lang=”php”]
echo session_save_path();
[/cc]
Set Session Save Path
To set the session save path you will just need to call the same function with parameter which is path of directory. Once you call this function your application’s session save path will get changed so it is good to set this path before calling the [code]session_start()[/code]. Have a look at the below code block to set the session save path.
[cc lang=”php”]
session_save_path(“/home/projects/projectx/session/”);
// Confirming the path
echo session_save_path();
[/cc]
Conclusion
This function will be very handy if you want to store the user related session on any folder which is on web server. You can share your thought if you have used this function on any other way.
Are you guys just reposting the docs? There doesn’t really seem to be anything else that has been added here…
[…] in file.If you are not sure what is the session save path then you should read this post about Session Save Path in PHP.Be default it will have below lines in your php.ini file. session.save_handler = files […]
[…] about storing the PHP Session in MemCache Server. Before this article I have also written about setting up PHP Session Path. With this article you should be able to instruct PHP to set your session on specific location […]