I'm trying really hard to save my sessions in different directory.
I have a shared server in OVH. Default session save path is /tmp
, and I want to change it.
In my root directory I have www
folder which is my main website folder. I created 'sessions' folder next to it, chmoded 777.
When I'm doing print_r(scandir('/home/expressptp/sessions/'));
i'm getting files just fine, but when I try to session_save_path('/home/expressptp/sessions');
nothing ever appears there.
Full code looks something like this:
session_save_path('/home/expressptp/sessions');
session_start();
echo session_id();
$_SESSION["test"] = "test";
echo session_save_path(); //that prints good path
But the problem is that in folder sessions
there are no sessions :(
I tried everything. I put 'sessions' folder in 'www', chmod 777, setting path with realpath(dirname($_SERVER['DOCUMENT_ROOT'])
, etc.
If you have any ideas I will be grateful.