If you change the default path with session_save_path,
the garbage collector of PHP will not remove session cookies.
Therefore you must write your own garbage collector, cron entry or shell script.
session_save_path
(PHP 4, PHP 5)
session_save_path — Lee y/o cambia la ruta donde se guardan los datos de la sesión actual
Descripción
string session_save_path
([ string $path
] )
session_save_path() devuelve la ruta del directorio usado actualmente para guardar los datos de la sesión. Si se especifica path , se cambiará la ruta donde se guardan los datos.
Note: En algunos sistemas operativos, puede que quiera especificar una ruta en un sistema de archivos que maneja muchos archivos pequeños de forma eficiente. Por ejemplo, en Linux, reiserfs puede dar un rendimiento mejor que ext2fs.
session_save_path
peer at nospam dot com
10-Jul-2008 03:34
10-Jul-2008 03:34
sampathperera at hotmail dot com - Sri Lanka
06-Feb-2008 01:25
06-Feb-2008 01:25
Session on clustered web servers !
We had problem in PHP session handling with 2 web server cluster. Problem was one servers session data was not available in other server.
So I made a simple configuration in both server php.ini file. Changed session.save_path default value to shared folder on both servers (/mnt/session/).
It works for me. :)
gt at psgam dot de
25-Feb-2005 07:58
25-Feb-2005 07:58
Note that you shouldn't use session_save_path() directly for performing file operations.
It returns the configuration option, not the directory.
As stated in /manual/en/ref.session.php#ini.session.save-path there can be a numeric argument separated with a semicolon in front of the "real" path.
I used the following code to get rid of it:
<?php
$sessionpath = session_save_path();
if (strpos ($sessionpath, ";") !== FALSE)
$sessionpath = substr ($sessionpath, strpos ($sessionpath, ";")+1);
?>
Doesn't allow ; to appear in the directory names, but hey.
Regards,
Gero
designofgod at yahoo dot com
14-Feb-2005 08:12
14-Feb-2005 08:12
sometime you need to change session.save_path because server system distributed more then one machine and you can not reach php.ini file example sourceforge.net. Then you can do that with .htaccess file which is kind of configuration file for Apache under one directory. anyway I added
php_value session.save_path /home/groups/f/f4/f4l/tmp/
now my sessions work very well I hope :)
webmaster at gardenchemicals dot co dot uk
16-Sep-2004 09:59
16-Sep-2004 09:59
This is an absolute must if you have an important login on a shared server. Without it, other users of the server can do the following to bypass login:
* Visit login page, browse through cookies and grab the session id.
* Create a PHP script on their account that grabs and sets session variables for a given session id.
* Read and change any values for that session id (for example passwords or session keys), and therefore gain access to the protected area.
All users on web hosting should choose an dir below the HTTP directory struct, but within their user area to store the session files.
a9504778 at unet dot univie dot ac dot at
14-Jan-2001 05:09
14-Jan-2001 05:09
dont forget: if you use session_save_path on the page, that registers a variable, you have also to use session_save_path on all the pages, where you access the session-variable. under win32 you can use the double \\ to specify eg "c:\\temp\\"
