PHP5 : Sharing session

2013-05-30
Laurent Bientz

If you begin to have an IS consisting of N satellites sites sharing the same main domain, know that it's easy in PHP to share the session between all vhosts of the same main domain.

// Forcing registration of PHPSESSID's cookie on the domain of higher level
ini_set("session.cookie_domain",".wandi.fr");
session_start();

Attention, last releases of Debian blocks this directive by default for security reasons. To enable it, add the following lines to php.ini (don't forget a small Apache restart):

suhosin.session.cryptua = off
suhosin.session.cryptdocroot = off

 

Comment

USER EXPERIENCE

Wandi invites you to discover a new approach to navigating a website...
Are you ready?

Launch the experience