qweqwe qwe
qweqwe qwe

Reputation: 393

more than 1 session.cookie_domain in php.ini

I just got a dedicated server and it has my 3 websites/domains, also I have use their subdomains (so session will be able to be shared within their subdomains).

in my php.ini file When I do this,

session.cookie_domain= ".site1.com"
session.cookie_domain= ".site2.com"
session.cookie_domain= ".site3.com"

It only stores site3.com's session. and doesn't create any sessions for site1.com and site2.com

how can I fix it?

Upvotes: 1

Views: 2565

Answers (1)

Adam
Adam

Reputation: 6107

PHP only sets ONE cookie when you call session_start(). You will not be able to share this cookie across primary domains (only subdomains).

Since all three domains likely share the same php.ini file you should set it for each domain/website separately in PHP using:

ini_set('session.cookie_domain', '.site1.com');

Upvotes: 2

Related Questions