title: Session was already started
body: <p>I am working on a project based on cakephp 3, which is moderately heavy in terms of php and mysql for processor and memory usage, but serves the exact same pages 99% of the times to the users.</p>
  
  <p>So I've decided like to use a caching system like <a href="https://github.com/ToX82/cakephp-supercache" rel="nofollow">this one</a> that I have developed a few years ago. It just saves a cached html file of the complete page, avoiding to do all the elaborations on each request. It's a dumb system, but it does its job pretty well.</p>
  
  <p>The problem is, I need to access the session variables for a few checks. To do so I trigger <code>session_start()</code> in my caching system, and sometimes cakephp throws this error when the page is not already cached:</p>
  
  <pre><code>Session was already started
  </code></pre>
  
  <p>How can I avoid this error? Is there a way to close the session in my caching system, so that cakephp can eventually start a new one? I have tried with <code>session_abort</code> and <code>session_register_shutdown()</code>, but the didn't work and I'm not even sure this is the correct way to do what I need...</p>
  
  <p>EDIT: The processing flow is: request -> caching system -> cakephp. Therefore my <code>session_start()</code> comes before the cakephp one and I'd prefere not to touch cakephp core files, that's why the other questions were not useful to me. I'd like to solve this problem in my caching system instead.</p>