title: PHP / Apache how to set session.cookie_domain from outside php.ini
body: <p>I need to restrict cookies to my www subdomain, this works by me adding the line session.cookie_domain = www.example.com in the php.ini file. However I have a number of virtual hosts on my server so I need this domain to be different for each one. After a bit of a web-seach, I have tried using:</p>
  
  <pre><code>'SetEnv session.cookie_domain www.example.com' - in my httpd.conf
  'php_flag session.cookie_domain www.example.com' in .htaccess
  </code></pre>
  
  <p>However both seem to stop cookies working all together!</p>
  
  <p>Any help much appreciated!</p>
  
  <p>Stu</p>