I have to restrict snacks to my world wide web subdomain, this functions by me adding the road session.cookie_domain = world wide web.example.com within the php.ini file. However have many virtual hosts on my small server and so i need this domain to become different for every one. After a little of the web-seach, I've attempted using:

'SetEnv session.cookie_domain www.example.com' - in my httpd.conf
'php_flag session.cookie_domain www.example.com' in .htaccess

However both appear to prevent snacks working altogether!

Any help much appreciated!


The simplest way to do this is by using session_set_cookie_params() rather than setting it via .htaccess (the .htaccess method only works if PHP can be used like a module). Technology-not only within the following way:

session_set_cookie_params(0, '/', 'www.example.com');

An alternative choice is by using ini_set :

ini_set("session.cookie_domain", "www.example.com");

During my situation that one labored for me personally:

setcookie("name", $Value4Name, time()+$3600 , "/", ".domain.com");

But to you to definitely record a cookie for that cause of the domain.

cheers PC