I recently turned off register_globals on my shared hosting site, by creating a php.ini file with the line in it to turn it off.
Everything works fine, except my session data seems to dissapear after about 2 mins!!
Here is the script I am using to test this.
Code: Select all
<?php
session_start();
if(session_is_registered("isSessionActive")){
echo 'session var is registered.<br><br>';
} else {
session_register("isSessionActive");
echo 'session var not registered, just registered it.<br><br>';
}
if(empty($_SESSION['isSessionActive'])){
$_SESSION['isSessionActive'] = 'Session is not active!';
echo $_SESSION['isSessionActive'];
} else {
echo 'Session is active.';
}
?>When I refresh, I expect to see that the session is registered and is active, which i do.
Now if I leave it for about 2-3 minutes. It goes back to being unregistered! I've tried to print the $_SESSIOn array and its empty!
I've checked my php.ini file and my timeouts for session.gcmaxlifetime is default of 1440 which is i believe 24 minutes.
If i delete the php.ini file i created to turn off register_globals, as in i turn it back on, this problem goes away.
All this is over https, btw.
Am I missing somethign here?
Thanks all.