Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several sites hosted on the same server, in different directories (e.g:, and I want to store the session files for each site in a different directory.
How do I do that?


share|improve this question

migrated from Sep 11 '10 at 11:20

This question came from our site for computer enthusiasts and power users.

up vote 2 down vote accepted

If you're running PHP as an Apache2 module, the following should work for you.

In the folder you want to change the session path (e.g, create a .htaccess file with the following in it:
php_value session.save_path "/path/to/separate/sessions/site_one".

Repeat this and change the directory for each folder you want to have a separate session path.

share|improve this answer
great! thanks a lot! – Alex Sep 11 '10 at 12:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.