php - $_SESSION across muliple virtual hosts -
i have learned if share server host (which do, have virtualhost), hosts share same $_session same across hosts.
does meant other hosts can access of variables store in $_session?
check value of following:
echo ini_get('session.save_handler'); echo ini_get('session.save_path');
if save_handler files
, save_path common directory /var/lib/php5
you're sharing session storage other users on server. you're still protected nature of session hash id, if have sensitive information might want make change. either change save_handler sqlite , provide own local database file, or change save_path directory that's owned , has minimal permissions. can change save_path in .htaccess file:
php_value session.save_path = '/path/to/my/session/directory'
or in php source:
ini_set('session.save_path', '/path/to/my/session/directory');
edit: realistically though, if have information sensitive enough warrant change, should using vps , not shared server.
Comments
Post a Comment