<p><em>As Brad Bell mentioned in <a href="https://craftcms.stackexchange.com/a/9629/5437">this answer</a>:</em></p>

<p>It can be that wherever Apache/PHP is configured to save session files doesn't exist or isn't writable.</p>

<p>If you've got the <a href="http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation" rel="nofollow noreferrer"><code>overridePhpSessionLocation</code></a> config setting set to <code>true</code>, then that will be in <code>craft/storage/runtime/sessions</code> folder.</p>

CC BY-SA 4.0
2018-07-19T07:30:14.440Z
2018-07-19T07:30:14.440Z
Simon East
<p>The problem was actually Chrome using iOS emulation when viewing the site, thus spoofing the UA string into something different than the usual Chrome UA string when logging into the admin area.</p>

<p>Solution (as suggested by @craftcms on Twitter) was to set:</p>

<pre><code>'requireMatchingUserAgentForSession' =&gt; false
</code></pre>

<p>In</p>

<pre><code>craft/config/general.php
</code></pre>

<p>For whatever environment you are having the issue.</p>

CC BY-SA 3.0
2014-11-10T14:00:53.207Z
2014-11-10T14:00:53.207Z
megatrond
<p>The problem seem to be that the session file in <code>/craft/storage/runtime/sessions</code> is getting removed any time I refresh the actual page, so that I have to do a new login everytime I've changed content, looked at the site, and then want to add more content.</p>

<p>This i running on Apache, PHP 5.3.29, locally through MAMP on Yosemite.</p>

<p>Is there some config setting I'm missing here?</p>

CC BY-SA 4.0
2018-07-19T07:36:10.710Z
There's also a number of good answers at *[Craft constantly logging out from admin area](https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area)*
Simon East
CC BY-SA 3.0
2014-11-10T12:20:34.130Z
Ok, don't really think it counts as a solution, more of a workaround, but setting 'userSessionDuration' to false in /craft/config/general.php prevents this from happening.
megatrond
<users><admin><session>
Getting logged out of admin area when refreshing site
# Getting logged out of admin area when refreshing site

(Asked by: username_0 on 2014-11-10)

The problem seem to be that the session file in `/craft/storage/runtime/sessions` is getting removed any time I refresh the actual page, so that I have to do a new login everytime I've changed content, looked at the site, and then want to add more content.

This i running on Apache, PHP 5.3.29, locally through MAMP on Yosemite.

Is there some config setting I'm missing here?

**Tags:** users, admin, session
> **Comments:**
> **username_0**: Ok, don't really think it counts as a solution, more of a workaround, but setting 'userSessionDuration' to false in /craft/config/general.php prevents this from happening.  
> **username_1**: There's also a number of good answers at *[Craft constantly logging out from admin area](https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area)*  

---

## 2 answers

### Answer by username_0 on 2014-11-10. Score: 10 | Accepted answer

The problem was actually Chrome using iOS emulation when viewing the site, thus spoofing the UA string into something different than the usual Chrome UA string when logging into the admin area.
Solution (as suggested by @craftcms on Twitter) was to set:
'requireMatchingUserAgentForSession' => false

In
craft/config/general.php

For whatever environment you are having the issue.


---

### Answer by username_1 on 2018-07-19. Score: 2

*As Brad Bell mentioned in [this answer](https://craftcms.stackexchange.com/a/9629/5437):*

It can be that wherever Apache/PHP is configured to save session files doesn't exist or isn't writable.

If you've got the [`overridePhpSessionLocation`](http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation) config setting set to `true`, then that will be in `craft/storage/runtime/sessions` folder.


---

