I was working on the css for my custom theme today on localhost. I refreshed my page to see the results of my edits and got this, rather unexpected, error:
Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in H:\srv\dcfwebroot\core\lib\Drupal\Core\Session\SessionHandler.php on line 20
I checked my git-diff and from the point before the error happened to the time that it did the only files that were modified were .scss and .css files within my theme. I tried restoring my database to a backup, no luck. I tried restoring my working tree to head (via git stash), no luck. Finally I tried restarting apache. This fixed the issue (at least for now).
I'm running XAMPP on Windows with Apache 2.4.18 and PHP 7.0.4. Currently I have no idea how to replicate the error unfortunately, but thought it would be best to alert people to it's happening.
Comments
Comment #2
dom. commentedSame error here. It really seems to have happen randomly while browsing my website.
The only way to get it working back is by restarting my server, which would not be possible on a mutualized prod environment.
Comment #3
ml1 commentedI'm seeing similar errors:
Fatal error: Class Drupal\\Core\\Session\\SessionHandler contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open, SessionHandlerInterface::read) in D:\\Apache24\\html\\core\\lib\\Drupal\\Core\\Session\\SessionHandler.php on line 15
Running Apache 2.4.18 from apachelounge and PHP 7.0.7.
As the original report states it seems to occur randomly.
Comment #4
Anonymous (not verified) commentedabsolutely identical situation for me with drupal 8.2:
Maybe problem multiple definitions exist for class SessionHandlerInterface?
Comment #5
Anonymous (not verified) commentedPerhaps it occurs after "Fatal error: Allowed memory size". But I could not reproduce it again.
Comment #6
marassa commentedGetting this one too. Not 100% sure but I think it happens when I open another session from another browser/device in the same network/same IP address as an already active session.
Running XAMPP on Windows with Apache 2.4.23, PHP 7, Drupal 8.2.3.
Comment #7
Anonymous (not verified) commentedHmmm.. after your post I wanted to try to get this bug again. I opened several browsers and began to run the compilation scss file and refresh page, and flush caches (although caching has been set in null). Very quickly (3-5 minutes later) I got an error:
after refresh page error bit change:
The error persists after the refresh page, and attempts to open the other pages of the site in other browsers. After restarting the server, the error gone.
I spent a whole hour trying to repeat it, but no results. Although it seemed to me that I just started to compile the wrong scss file and flush cache (or refresh page).
Comment #8
johnnny83 commentedI got the same error after upgrading xampp from PHP 5.6.19 to 7.0.13
Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in C:\Users\********\web\core\lib\Drupal\Core\Session\SessionHandler.php on line 15Comment #9
marassa commentedI stopped getting that error once I moved from XAMPP to hosted environment (linux).
Comment #10
johnnny83 commentedAnd now I got the second error of #7
Comment #11
Anonymous (not verified) commentedExcellent! But I could not get this error switching between the 5.6 and 7. Can you describe more about your configuration? Maybe attach error logs.
Comment #12
johnnny83 commentedComment #13
johnnny83 commentedTwo new observations:
1) After turning off opcache the "DatabaseStorage" error doesn't appear anymore
2) When the "abstract method" error occurs, it does on all Drupal installations on my localhost environment at the same time
Comment #15
mobil_maniak commentedSame issue,
1) After turning off opcache in php.ini. error doesn't appear anymore
2) updated d 8.2.2 to 8.2.6
3) after turning on opcache drupal works without errors/warnings
EDIT: 1 day after
Without any change in settings/modules/xampp error pops out:
Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open) in C:\xampp\htdocs\test\core\lib\Drupal\Core\Session\SessionHandler.php on line 15by the way: Error Log is empty.
I tried Flush all cashes and error disappeared.
Comment #16
johnnny83 commentedInteresting, for me only restarting Apache works...
Comment #17
codeitwisely commentedSame as Johnny83 in #16, restarting apache worked!
Comment #18
saranya ashokkumar commentedAfter Restarting Apache that issue fixed for me!
Comment #19
gogowitsch commentedFor me, this is happening on Drupal 8.2.3 and PHP 7.1.2 from XAMPP. This is not a Drupal-specific error, as other ecosystems see the Apache restart as a remedy, too: 1, 2, 3, 4, 5, 6, 7
Comment #20
kalidasan commentedStarted working after restarting Apache :)
Comment #22
mariami.ta commentedFor me also after restarting Apache error is gone!
Comment #23
ravinderreddyg7 commentedRestarting Apache fixed the issue.
Comment #24
theicydeveloper commentedAfter restarting Apache on Xampp this issue is gone.
I encounter this issue when adding image and clicking preview.
Comment #25
h.munster commentedRestarting Xampp worked for me as well.
Comment #26
theicydeveloper commentedI get this error sometimes. My custom modules does call some external REST API and send back a Symfony Response object. Most of the times requests go through but sometimes i get "Fatal error: Class Drupal\Core\Session\SessionHandler" error.
Any one knows any relation of this error with Symfony API?
Comment #27
Anonymous (not verified) commentedMy main guess is that this is an Apache problem with limit of computer resource. I received this error twice:
Both cases were on a not very powerful Windows machine (unfortunately, I do not remember the version of Apache).
I have never been able to reproduce this on a more powerful machine with a large amount of resources (both under Windows and under Ubuntu).
In other words, this is not Drupal problem (otherwise it means, that Drupal can full disable the server). However, this very useful issue as support documentation, because it helps to quickly understand what needs to be done - restart Apache.
#26: if this error does not lead to the need to restart Apache, then this is another error, not related to this issue, albeit with a similar name.
Comment #28
ravimalviya2000 commentedSame error here. It really seems to have happen randomly while browsing my website.
The only way to get it working back is by restarting my server, which would not be possible on fix this error.
Comment #29
hassengh commentedaffect to memory limit 254M ( memory_limit = 254M )
it is worked for me
Comment #31
Tzu-Chi Huang commentedI have the similar errors too. (Drupal 8.4.4)
Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in C:\Apache24\htdocs\core\lib\Drupal\Core\Session\SessionHandler.php on line 15
Current my workaround: Disable "Page cache maximum age" by setting it
Comment #32
gzveri commentedDrupal 8.4.4 + XAMP, when trying to uninstall a module got the same error :
Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open) in C:\mysites\htdocs\d8afsc\core\lib\Drupal\Core\Session\SessionHandler.php on line 15
After restarting XAMP apache and mysql, the site worked fine and I was able to uninstall the module.
Comment #33
gogowitsch commentedI am convinced this is a bug in either PHP or Apache binaries. It cannot be solved within Drupal.
Comment #34
dhaval_panara commentedI found same kind of error and issue resolved after restarting my server but this is problematic while working on prod environment. Is there any proper solution rather than restart the server?
Comment #35
rbrownellFor me, disabling OPcache and restarting Apache worked but stopped working within an hour or so on a server that was being shared by multiple developers developing several different Drupal websites. We also made sure that PHP on this development server had access to plenty ram 3GB to be exact. This is also a CentOS 7 server running PHP 7.1 and Apache 2.4.
What ultimately worked for us was modify the OPcache settings... Here is what I changed:
Ultimately, I think the last one item is what did it for us. Drupal 8 has roughly 30,000 files in core alone, if PHP is only able to cache 4000 of those, there could be issues with dependencies being available at runtime.