Extras
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: /Applications/MAMP/tmp/php/
XAMPP on a PC: C:\xampp\tmp
The php.ini
file specifies location where the web server saves session files; it is stored in a setting called session.save_path
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 session.save_path
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.