Fenhopi Posted August 13, 2011 Share Posted August 13, 2011 Okay, so I have this site mydomain.com. When the user logs on there I want the user to be able to go to forum.mydomain.com without getting logged out. So I've googled this for days, and here's what I've found out: I don't have access to my hosts php.ini file, so I can't change anything there. I've put ini_set("session.cookie_domain", ".mydomain.com"); on top of my session.php file. I've edited the .htaccess in both the forum folder and my root folder to php_value session.cookie_domain ".mydomain.com" . Still, after all this; it's totally random wether the session works on both or not. Sometimes it works, others it doesn't. I think perhaps it usually stops working after I've edited on some files on my site.. but I just have no idea what's wrong.. All help would be appriciated! Quote Link to comment https://forums.phpfreaks.com/topic/244681-session-problems-with-sub-domain/ Share on other sites More sharing options...
ohdang888 Posted August 13, 2011 Share Posted August 13, 2011 i got stuck on this for a while, and it turns out existing cookies were messing my logic patterns up. Clear your cookies, restart your browser, and try again Quote Link to comment https://forums.phpfreaks.com/topic/244681-session-problems-with-sub-domain/#findComment-1256791 Share on other sites More sharing options...
Fenhopi Posted August 14, 2011 Author Share Posted August 14, 2011 Thanks for you reply! But, it didn't work.. Quote Link to comment https://forums.phpfreaks.com/topic/244681-session-problems-with-sub-domain/#findComment-1256992 Share on other sites More sharing options...
PFMaBiSmAd Posted August 14, 2011 Share Posted August 14, 2011 it usually stops working after I've edited on some files on my site Your editor is likely saving the file as a UTF-8 encode file with the BOM (Byte Order Mark) characters at the start of the file and that is causing a header error (you would be getting an error message stating that output is being sent before the session_start statement.) You should have error_reporting (always) set to E_ALL and for development display_errors should be ON and on a live server display_errors should be OFF and log_errors should be ON. If you are doing this on a development system, the suggested settings would be outputting all the php detected errors. On a liver server, the suggested settings would be logging all the php detected errors. If after seting the error_reporting/display_errors/log_errors settings, you are getting an error indicating output is being sent on line one of the file, you need to save your files without the BOM characters. Quote Link to comment https://forums.phpfreaks.com/topic/244681-session-problems-with-sub-domain/#findComment-1256999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.