I am trying to use session data on multiple subdomains:
- www.example.com
- my.example.com
- test.example.com
- whateversub.example.com
When I try to use session data from www.example.com to any subdomain, all the session information is not accessible.
- I am NOT using cookies. Just sessions.
- I have GoDaddy as web host.
- GoDaddy DOES allow to upload a custom php5.ini file.
Since I am a PHP beginner, please dumb down your response so I may understand it.
Here is an example:
File 1:
<?php
// FILE 1: www.example.com/index.php
session_start();
$_SESSION['status'] = "ON";
header( 'Location: http://sub.mywebsite/' );
?>
File 2:
<?php
// FILE 2: sub.example.com/index.php
session_start();
echo "Your session status is: ";
echo $_SESSION['status'];
?>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…