note 87392 modified in ref.session by danbrown

From: Date: Thu, 07 Oct 2010 23:45:15 +0000
Subject: note 87392 modified in ref.session by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173075@lists.php.net to get a copy of this message
For UNIX : One might encounter some problems with sessions, having different sites on the same server : sessions would either merge if one is using more than one site at a time or crash if sites are owned by different system users. For instance : www.example.com is stored in /home/site1/www www.example.net is stored in /home/site2/www Using both www.example.com and www.example.net would cause sessions to act weird. If you're using PHP as an Apache module, you can easely use php_value in the http.conf to set a unique session.name depending on the site. If you're using suPHP though (PHP as CGI) you can't use php_value, though you can use suPHP_ConfigPath. Here's an example : <VirtualHost 10.10.10.10:8081> DocumentRoot /home/site1/www ServerName www.example.com suPHP_ConfigPath /home/site1/server_config </VirtualHost> <VirtualHost 10.10.10.10:8082> DocumentRoot /home/site2/www ServerName www.example.net suPHP_ConfigPath /home/site2/server_config </VirtualHost> Each server_config folder contain a php.ini file specific to the vHost. You then just have to change the values of each session.name to unique ones and you're done ! --was-- For UNIX : One might encounter some problems with sessions, having different sites on the same server : sessions would either merge if one is using more than one site at a time or crash if sites are owned by different system users. For instance : www.site1.com is stored in /home/site1/www www.site2.com is stored in /home/site2/www Using both www.site1.com and www.site2.com would cause sessions to act weird. If you're using PHP as an Apache module, you can easely use php_value in the http.conf to set a unique session.name depending on the site. If you're using suPHP though (PHP as CGI) you can't use php_value, though you can use suPHP_ConfigPath. Here's an example : <VirtualHost 10.10.10.10:8081> DocumentRoot /home/site1/www ServerName www.site1.com suPHP_ConfigPath /home/site1/server_config </VirtualHost> <VirtualHost 10.10.10.10:8082> DocumentRoot /home/site2/www ServerName www.site2.com suPHP_ConfigPath /home/site2/server_config </VirtualHost> Each server_config folder contain a php.ini file specific to the vHost. You then just have to change the values of each session.name to unique ones and you're done ! http://php.net/manual/en/ref.session.php

« previous php.notes (#173075) next »