Do I need to change the session.save_path directive for each virtual host to use their own directory other than the system and/or PHP default (/tmp) in order to effectively override each virtual host session.gc_maxlifetime directive?

Let me offer an example for clarification.

Example:
--------
A shared hosting provider has 10 domains running on an Apache server with PHP. www.shared_host1.com wants to set his session.gc_maxlifetime to 60 minutes. To do so, he must either use ini_set or a PER_DIRECTORY override file (.htaccess) to change the default directive setting of 1440 (24 minutes) to 3600. Now www.shared_host2.com wants to use sessions as well, but decides that a ten hour setting would be ideal, so www.shared_host2.com alters the directive in the same manner, setting the value to 36000. Now we know that ini_set is going to keep this new value during the script's execution, and will be restored at the script's ending, and a .htaccess file would work the same way. We also know (by opening and viewing the contents of a session file in the /tmp directory) that there is nothing in the file itself that designates when it will expire, PHP merely looks at the file mtime (atime, if < PHP 4.2.3). What I mean by this is that PHP doesn't look at the mtime of the file and compare it with some internal value to figure out if it should be trashed. If both hosts sessions are being written and saved in the default directory (/tmp), then I am assuming the session directives of the current session request determine whether or not garbage collection is going to be run, and if it happens to be www.shared_host1.com, then any sessions older than 60 minutes will be trashed, including those from www.shared_host2.com. Is this a correct statement? And if so, if each shared host were to save their own session files in their own directory using session.save_path (/shared_host1/tmp, for example), would this be the ideal way to use the directives, IN COMBINATION, to get the desired effect on virtual hosted (shared) servers?
--------


I've spent some time looking for a definitive guide to the internal workings of the PHP session.gc_maxlifetime directive, particulary it's impact/effect on servers with virtual hosting (shared servers). A search across this news list as well as the php.doc turned up a couple of threads, but none that answers the question.

Regards,
coopster

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to