OK, so I've read that it is possible to use session variables across multiple sub-domains and domains by placing the following in the .htaccess file on each of the prospective domains:

php_value session.gc_maxlifetime 14400
php_value session.cookie_domain ".domain_name.com"

where domain_name.com is the domain where the session was initiated.

I know this works for sub-domains, because I have used it, but my question is:

Is there a way to make it work across multiple domains on the same server?

My test was this:

domainA.com/index (with .htaccess as above)

<a href="http://domainB.com"  target="_blank">Test cross over</a>

Then on domainB.com/index (with .htaccess as above)

$passed=$_SESSION['aff'] ;
print " passed aff is : *".$passed."*";


The result:

passed aff is **

if it was working it would have TestName between the **

So, does anyone know if this is possible to accomplish, or maybe if I am doing something wrong?

Thanks in advance for any help you could give me.


6 Years
Discussion Span
Last Post by showman13


Thank you for your response. This is the second thread that received a response that I wasn't aware of. Better check my junk box for the notifying emails.

I honestly still don't know if it can be done, but did find another resolution to the issue. I found out that I could just access the database from one domain on any other domains on the same server/hosting account, so I am doing that instead of trying to maintain a bunch of session variables.

Like they say, 'there is more than one way to skin a cat'... Why you would want to skin a cat, I have no idea.

thanks again

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.