In my drupal site, it has been working fine for a while, but recently users have not been able to log in to the site (including me as admin). I am seeing the following error in my php logs:

[28-Jul-2018 20:07:02 UTC] Uncaught PHP Exception RuntimeException: "Failed to start the session" at (webroot)/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 145

I went to look at the code and i see it corresponds with the following lines:

    if (!session_start()) {
        throw new \RuntimeException('Failed to start the session');

I have tried clearing the sessions tables as well as the cache using core/rebuild.php and nothing seems to be working. Another note for this I had to add this line temporarily

$settings['rebuild_access'] = TRUE;

in my settings.php to get it to work also, because the token generator script was throwing another error like below:

[28-Jul-2018 20:39:01 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Drupal\Core\Site\Settings::initialize(), 1 passed in (webroot)/core/scripts/rebuild_token_calculator.sh on line 22 and exactly 3 expected in (webroot)/core/lib/Drupal/Core/Site/Settings.php:108

Not sure if this is related to the main error or not, but thought it may be worth mentioning.

  • Check for disk space issues. If you have run out of space, this is one possible symptom. Jul 28, 2018 at 21:55
  • Seems like I'm good on disc space, only using 200MB of 100GB available, DB size is only 12MB.
    – atg963
    Jul 28, 2018 at 21:59
  • 1
    The other classic reason for session failing to start is there having been some output before the session_start() call. For example if index.php has a newline before the "<?php". Worth checking to see if all the source files are as they should be, in case one has somehow got corrupted. Jul 29, 2018 at 16:04
  • oh ok I will try and go through and see if I can find anything. Before this started happening no one has really accessed the webserver so seems unlikely. I have been looking around to see if there is some way to get the reason why session_start() fails in php, is there something i can add to get some kind of trace on the failure? (Also for what its worth, i found that php is saving the session data to the /tmp folder on my server)
    – atg963
    Jul 29, 2018 at 20:11


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.