How to Find Session Files
If you develop a site that uses sessions, you might want to check that the session files are being created correctly, and then check their last modified time to ensure that they are being updated.
To do this, you need to know where your web server is saving the session files. If you are running MAMP or XAMPP locally, the default paths for session files are:
MAMP on a Mac:
XAMPP on a PC:
php.ini file specifies location where the web server saves session files; it is stored in a setting called
To check the value of this setting, you can check in the
php.ini file or call PHP's
phpinfo() function, then search for the term
You can also use PHP's
ini_get() function to find the current setting (as shown below):
<?php echo ini_get('session.save_path'); ?>
NOTE: You should not leave a file that exposes the location of the session files on a public server.