Where is a PHP session file stored?

1

I've read about files related to $_SESSION , but I'd like to find them. Where are they stored?

    
asked by anonymous 25.09.2017 / 16:33

2 answers

5

The storage location of the $ _SESSION variable is determined by setting session.save_path "of PHP. Typically, the path is /tmp on a Linux / Unix system.

Use phpinfo() to see your settings if you are not 100% sure of the location. Just create a .php file with this code in the DocumentRoot of your domain:

<?php
   phpinfo();
?>

Note

As said in the comments, and also very important to note:

  

In a simplified way, you can use the session_save_path() function that controls this policy .

If you use session_save_path() , you will be able to simplify finding the storage location of the session variables:

<?php
    echo session_save_path();
?>

We also have a question answered about this in our Big Brother SO .

    
25.09.2017 / 16:34
1

On the server, of course, it would not make sense to keep this control on the client, this information is necessary for the application to maintain some state between requests.

    
25.09.2017 / 16:35