keeping sessions alive over subdomains
In your .htaccess you can set your session cookie domain to the base.
php_value session.cookie_domain ".domain-uk.net"
You can also do this inside of your application:
<?php
session_set_cookie_params(0, '/', '.domain-uk.net');
session_start();
?>
PHP session works on all subdomains
There are several things to take in account while sharing $_SESSION
across subdomains.
Are all subdomains on ran by the same server?
If not, then, you will need to share sessions amongst servers, there are several solutions:
- Use NFS (not recommended)
- Move SESSION to another storage (Database, Memcache, Redis) (best option imho)
If they are, you may just need to configure your cookie domain using
session.cookie_domain
ini directive.
Are you running Suhosin, if you do, you may need to disable some security options to allow your session to be decrypted on the others servers.
Related Topics
Illegal String Offset Warning PHP
PHP Does Not Display Error Messages
Can PHP Curl Retrieve Response Headers and Body in a Single Request
How to Get Multiple Selected Values of Select Box in PHP
How to Update Code That Uses the Deprecated Each() Function
Move_Uploaded_File Gives "Failed to Open Stream: Permission Denied" Error
Curl Error 60: Ssl Certificate: Unable to Get Local Issuer Certificate
Calculate Math Expression from a String Using Eval
Merge Two Arrays as Key Value Pairs in PHP
Converting String to Date and Datetime
How to Get a File'S Extension in PHP
Startswith() and Endswith() Functions in PHP
How to Make Asynchronous Http Requests in PHP
How to Display HTML Tags as Plain Text
Finding Cartesian Product With PHP Associative Arrays