<p>Resolved.</p>

<p>This ended up being an issue with, so far as I can tell, my env variables--specifically a misconfiguration with the <code>basePath</code>.</p>

CC BY-SA 3.0
2018-04-05T13:59:17.280Z
2018-04-05T13:59:17.280Z
Chris
<p><strong>Environment</strong><br>
Craft: 2.6.3013 (Personal)<br>
MAMP Pro: 4.4.1<br>
PHP: 7.0.12 (CGI Mode)</p>

<p><strong>Behavior</strong><br>
After logging into the CP, and following a relatively short period of time, the session expires unexpectedly and Craft requests a login. Attempting to log in fails and immediately returns to the login modal; however, simply refreshing the page re-establishes the session, but again for only the limited period of time.</p>

<p>Looking at <code>/craft/storage/runtime/sessions</code> I see that Craft is creating a number of sessions, some of them being zero bytes.</p>

<p><strong>Attempted Solutions</strong><br>
I've tried the following, based on other users' past experiences and solutions:</p>

<ul>
<li>In general.php: <code>'requireMatchingUserAgentForSession' =&gt; false</code> </li>
<li>In general.php: <code>'overridePhpSessionLocation' =&gt; true</code></li>
<li>In php.ini: <code>session.auto_start = 0</code></li>
<li>Permissions set to 777 for <code>/craft/storage/runtime</code></li>
<li>In MAMP, enable/disable "Xdebug (Debugger)" PHP extension</li>
<li>Lastly, tested in both PHP 7.0.12 and 5.6.32 without CGI mode</li>
</ul>

<p><strong>Next Steps?</strong><br>
Does it appear that I've missed anything in my previous steps? I've been using Craft 2 for a couple of years in a variety of environments--MAMP 3 / Vagrant / Docker--and haven't experienced this before. The issue isn't a showstopper, but certainly an annoyance, and I would be grateful for thoughts on what to try next.</p>

CC BY-SA 3.0
2018-04-02T20:12:25.110Z
This might prove helpful - https://nystudio107.com/blog/the-case-of-the-missing-php-session
Jalen Davenport
<control-panel><admin><session>
Craft 2 CP session expires unexpectedly, requires repeated login
# Craft 2 CP session expires unexpectedly, requires repeated login

(Asked by: username_0 on 2018-04-02)

**Environment**  
Craft: 2.6.3013 (Personal)  
MAMP Pro: 4.4.1  
PHP: 7.0.12 (CGI Mode)

**Behavior**  
After logging into the CP, and following a relatively short period of time, the session expires unexpectedly and Craft requests a login. Attempting to log in fails and immediately returns to the login modal; however, simply refreshing the page re-establishes the session, but again for only the limited period of time.

Looking at `/craft/storage/runtime/sessions` I see that Craft is creating a number of sessions, some of them being zero bytes.

**Attempted Solutions**  
I've tried the following, based on other users' past experiences and solutions:

* In general.php: `'requireMatchingUserAgentForSession' => false`
* In general.php: `'overridePhpSessionLocation' => true`
* In php.ini: `session.auto_start = 0`
* Permissions set to 777 for `/craft/storage/runtime`
* In MAMP, enable/disable "Xdebug (Debugger)" PHP extension
* Lastly, tested in both PHP 7.0.12 and 5.6.32 without CGI mode

**Next Steps?**  
Does it appear that I've missed anything in my previous steps? I've been using Craft 2 for a couple of years in a variety of environments--MAMP 3 / Vagrant / Docker--and haven't experienced this before. The issue isn't a showstopper, but certainly an annoyance, and I would be grateful for thoughts on what to try next.

**Tags:** control-panel, admin, session
> **Comments:**
> **username_1**: This might prove helpful - https://nystudio107.com/blog/the-case-of-the-missing-php-session  

---

## 1 answers

### Answer by username_0 on 2018-04-05. Score: 1 | Accepted answer

Resolved.

This ended up being an issue with, so far as I can tell, my env variables--specifically a misconfiguration with the `basePath`.


---

