# A session had already been started

**URL:** <https://help.nextcloud.com/t/a-session-had-already-been-started/81037>\
**Category:** ℹ️ Support\
**Tags:** github\_issue\_exists, nc19\
**Created:** [May 10, 2020, 9:56am UTC](https://help.nextcloud.com/t/a-session-had-already-been-started/81037 "2020-05-10T09:56:32Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![NuageMagique](https://help.nextcloud.com/user_avatar/help.nextcloud.com/nuagemagique/32/27210_2.png) [@NuageMagique](https://help.nextcloud.com/u/NuageMagique)\
**Post date:** [July 17, 2020, 9:27pm UTC](https://help.nextcloud.com/t/a-session-had-already-been-started/81037/11 "2020-07-17T21:27:22Z")

</div>

I encountered the same problem after upgrading from Nextcloud “19.0.0.12” to “19.0.1.1”.

At first glance, I also didn’t understand the solution / workaround from [https://github.com/nextcloud/server/issues/20490](https://github.com/nextcloud/server/issues/20490)

Then I realized by reading more carefully that the solution was in the following comment :  
[https://github.com/nextcloud/server/issues/20490#issuecomment-645322499](https://github.com/nextcloud/server/issues/20490#issuecomment-645322499)

At the end of this comment, you’ll find the “Update Internal.php” link pointing here :

> <https://github.com/HolgerHees/server/commit/ad35c46d4c8e046a8abe364fce25c8b7d90b4dc7>

It will show the fix you have to apply to the “lib/private/Session/Internal.php” file.

Mine is here on my Linux server, but your path might differ if you chose another web root for your installation :  
/var/www/nextcloud/lib/private/Session/Internal.php

For safety reasons, I recommend making a backup of this file first.

Then, all you have to do is edit this file and look for the following function :

```
        public function clear() {
                $this->invoke('session_unset');
                $this->regenerateId();
                $this->startSession();
                $_SESSION = [];
        }

```

Then you have to comment out the “$this-\>startSession();” line, for it is the very line causing the bug :

```
        public function clear() {
                $this->invoke('session_unset');
                $this->regenerateId();
                /* $this->startSession(); */
                $_SESSION = [];
        }

```

You can also remove this line if you prefer. It’s up to you.

When you’re finished, don’t forget clearing your web browser cache, then just connect to your Nextcloud instance with a regular user and disconnect. Connect back as admin user to check your logs.

The “session\_start(): A session had already been started” error should not be thrown again.

---

_[View the full topic](https://help.nextcloud.com/t/a-session-had-already-been-started/81037)._
