Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/244681-session-problems-with-sub-domain/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.