Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to determine the *actual* session save path?

Tags:

php

session

I know there are half a dozen ways to get the value of the session.save_path directive (phpinfo(), session_save_path(), etc.), but when the value is an empty string, as it is by default, the actual path can be any of several locations. I've read that it's usually /tmp, except when it's /var/lib/php5, but on OS X Mountain Lion it's definitely /private/var/tmp. On Windows, it's probably C:\Windows\Temp, but who knows.

I could specify the location, but that won't really help me. I'm trying to diagnose a tricky problem and I would like to know what the current location is on a server that I don't have full access to. If there's a right way to do it, I haven't been able to find it. I'm open to clever hacks.

like image 831
Adam Siler Avatar asked Aug 07 '13 17:08

Adam Siler


1 Answers

I have not reviewed the PHP source code to confirm this, but it looks like when session.save_path is empty, PHP uses the value of sys_get_temp_dir() (which varies by user).

like image 120
Adam Siler Avatar answered Nov 14 '22 23:11

Adam Siler