<p>Thanks to Brad's help, we discovered that the server was misconfigured with an incorrect value for <code>session.cookie_domain</code>. Fixing that resolved the issue in this case.</p>

CC BY-SA 3.0
2017-04-20T13:16:55.417Z
2017-04-20T13:16:55.417Z
Derek Hogue
<p>Try all of the above suggestions first, then...</p>

<p>If you've added the configuration of 'defaultCookieDomain' to /craft/config/general.php as I did, you may see this error. I'm using MAMP which has no value set for session.cookie_domain in php.ini. I'm assuming that the conflict between my config setting in Craft and the setting in php.ini was the cause of this issue? To resolve the issue, I just removed the defaultCookieDomain in Craft general.php and the problem is resolved. </p>

<p>I'm not sure that it's even necessary to set defaultCookieDomain considering what the Craft documentation says about this config: "The default domain name Craft will use when sending cookies to the browser. If it is left blank, Craft will leave it up to the browser to decide – which will be whatever the current request’s domain name is."</p>

CC BY-SA 3.0
2017-11-01T20:16:31.420Z
2017-11-01T20:16:31.420Z
Vaughn D. Taylor
<p>I know many other folks have posted this question over the years, but unfortunately none of the answers given so far are fixing this for me.</p>

<p>The problem: after logging-in on my staging server (this does not happen locally with MAMP), after a minute the "Your session has ended" modal comes up. Entering my password dismisses the modal for a second then it comes right back.</p>

<p>If I simply reload the page, I am still logged-in, but the modal will come back after another minute. Also, reloading causes my Craft identity cookie to keep its name but change its value.</p>

<p>If I look in /craft/storage/runtime/sessions, I can see that when the modal comes up, a new session file has been created, but is a 0 length file. All the session files have 600 permissions.</p>

<p>What I've tried/checked with no success:</p>

<ul>
<li><code>session.auto_start = 0</code> is already set in the php.ini</li>
<li><code>session.save_path</code> shows up correctly as 
<code>/home/&lt;user&gt;/craft/storage/runtime/sessions/</code></li>
<li>have tried both the <code>overridePhpSessionLocation</code> and <code>requireUserAgentAndIpForSession</code> config variables set to <code>true</code> and <code>false</code></li>
<li>have deleted and recreated the <strong>sessions</strong> folder manually with 777 permissions</li>
<li>have deleted the <strong>sessions</strong> folder and let it be recreated by Craft (was created with 775 permissions)</li>
<li>I am not using any CDN/caching, or running this on Vagrant.</li>
</ul>

<p>The server is running Apache/2.2.3 (Unix) and PHP 7.1.0.</p>

<p>Is there anything else I can try?</p>

CC BY-SA 3.0
2017-04-17T21:12:16.697Z
Are you in a load-balanced web environment by chance?
Brad Bell
CC BY-SA 3.0
2017-04-18T20:10:16.370Z
Sorry for the delay Brad. I am not, no.
Derek Hogue
CC BY-SA 3.0
2017-04-18T21:10:52.590Z
Anything session related being logged in `craft/storage/runtime/logs` when it happens?
Brad Bell
CC BY-SA 3.0
2017-04-19T13:04:06.387Z
Nope, nothing gets logged at all when the session times out in fact.
Derek Hogue
CC BY-SA 3.0
2017-04-19T18:05:49.813Z
Hrm... I assume you've been through https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area
Brad Bell
CC BY-SA 3.0
2017-04-19T19:20:06.670Z
Yup, all those solutions and others as well. I'd be happy to send you access if you'd be willing to take a look!
Derek Hogue
CC BY-SA 3.0
2017-04-19T20:02:20.843Z
If you want to send some CP/FTP creds over to support@craftcms.com, we can poke around a bit.
Brad Bell
<config><session>
"Your session has ended" modal popping up constantly
# "Your session has ended" modal popping up constantly

(Asked by: username_0 on 2017-04-17)

I know many other folks have posted this question over the years, but unfortunately none of the answers given so far are fixing this for me.

The problem: after logging-in on my staging server (this does not happen locally with MAMP), after a minute the "Your session has ended" modal comes up. Entering my password dismisses the modal for a second then it comes right back.

If I simply reload the page, I am still logged-in, but the modal will come back after another minute. Also, reloading causes my Craft identity cookie to keep its name but change its value.

If I look in /craft/storage/runtime/sessions, I can see that when the modal comes up, a new session file has been created, but is a 0 length file. All the session files have 600 permissions.

What I've tried/checked with no success:

* `session.auto_start = 0` is already set in the php.ini
* `session.save_path` shows up correctly as
  `/home//craft/storage/runtime/sessions/`
* have tried both the `overridePhpSessionLocation` and `requireUserAgentAndIpForSession` config variables set to `true` and `false`
* have deleted and recreated the **sessions** folder manually with 777 permissions
* have deleted the **sessions** folder and let it be recreated by Craft (was created with 775 permissions)
* I am not using any CDN/caching, or running this on Vagrant.

The server is running Apache/2.2.3 (Unix) and PHP 7.1.0.

Is there anything else I can try?

**Tags:** config, session
> **Comments:**
> **username_1**: Are you in a load-balanced web environment by chance?  
> **username_0**: Sorry for the delay Brad. I am not, no.  
> **username_1**: Anything session related being logged in `craft/storage/runtime/logs` when it happens?  
> **username_0**: Nope, nothing gets logged at all when the session times out in fact.  
> **username_1**: Hrm... I assume you've been through https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area  
> **username_0**: Yup, all those solutions and others as well. I'd be happy to send you access if you'd be willing to take a look!  
> **username_1**: If you want to send some CP/FTP creds over to support@craftcms.com, we can poke around a bit.  

---

## 2 answers

### Answer by username_0 on 2017-04-20. Score: 3 | Accepted answer

Thanks to Brad's help, we discovered that the server was misconfigured with an incorrect value for `session.cookie_domain`. Fixing that resolved the issue in this case.


---

### Answer by username_2 on 2017-11-01. Score: 2

Try all of the above suggestions first, then...

If you've added the configuration of 'defaultCookieDomain' to /craft/config/general.php as I did, you may see this error. I'm using MAMP which has no value set for session.cookie\_domain in php.ini. I'm assuming that the conflict between my config setting in Craft and the setting in php.ini was the cause of this issue? To resolve the issue, I just removed the defaultCookieDomain in Craft general.php and the problem is resolved.

I'm not sure that it's even necessary to set defaultCookieDomain considering what the Craft documentation says about this config: "The default domain name Craft will use when sending cookies to the browser. If it is left blank, Craft will leave it up to the browser to decide – which will be whatever the current request’s domain name is."


---

