Session save path in PHP
by sabitha[ Edit ] 2012-06-07 15:09:33
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.
echo session_save_path();
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 session_start(). Have a look at the below code block to set the session save path.
session_save_path("/home/projects/projectx/session/");
// Confirming the path
echo session_save_path();