Saturday, April 18, 2020

Fixed: Where PHP sessions are stored?

This is setup using the following parameter:

session.save_path  

By default, at least in PHP 7.3, this is commented in php.ini:
;session.save_path = "/tmp"

It means default location is the following one:
/var/lib/php/session

In there you'll get files like the below:
[root@ip-172-31-39-55 session]# ls -l
-rw------- 1 apache apache 71 Apr 18 18:31 sess_0a2bbj0u9nsf9gh5vbddte855e
-rw------- 1 apache apache  0 Apr 18 11:13 sess_0uttil3jnenoos2kcf6t45gqj5
-rw------- 1 apache apache  0 Apr 17 15:30 sess_1f57jnsc28gj06km301b4von1a
-rw------- 1 apache apache  0 Apr 18 10:39 sess_2ips2j6djo8fst8lm4lq9q7l6n
-rw------- 1 apache apache  0 Apr 18 09:23 sess_32ta8talaki4a7umbuq6ivfqdi



If you also have have session parameters ($_SESSION['parameter']), you shall see those in file:
cat sess_vssets4hr5b1h89ad7k93q3rhl
loggedin|b:1;name|s:1:"D";id|i:6;

No comments:

Post a Comment