I built my first D8 site locally and successfully deployed it to cheap shared hosting. Now, as I try to migrate the deployed site back to my localhost I get the error:

Class 'Drupal\Core\Session\AccountInterface' not found in /var/www/html/core/includes/bootstrap.inc on line 58

A search seems to only find solutions related to Drush version. However, I have not used Drush. My migration process is manual. Specifically:

1) Clear all cache, uncheck aggregate CSS/js and select no page cache.
2) Make DB backup (using Backup DB module)
3) Restore DB locally (using cmd line)
4) Copy file system (via FTP)
5) Point settings.php at local database
6) Set correct local file system permissions

I suspect I have overlooked a configuration setting/step but cannot find it! Any suggestions to help solve the problem appreciated.

Thanks, Polly

UPDATE (following help from VM)
I forgot to say I am seeing a WSOD. I turned error reporting on in index.php.

I emptied cache_x & session tables.

If I put in garbage for the database name in settings.php the error remains the same (does this mean the error occurs before Drupal even tries to read the DB?).

Comments

VM’s picture

try clearing the sessions table @ localhost and logging back in.

Polly’s picture

Thanks VM.

Apologies, I omitted an important bit of info from my original post. I am actually seeing the WSOD. I am reading the error after turning on error reporting in index.php.

If I brpowse to: http://localhost/user I see WSOD + the 'AccountInterface not found' PHP error. So I am unable to login.

I have also tried browsing to:
http://localhost/core/rebuild.php
http://localhost/update.php

These both show WSOD without the PHP error.

Using PHPmyadmin I have emptied all cache_x tables. However, I do not seem to have a table called "sessions".

VM’s picture

There should certainly be a sessions table. It's where the session data is stored for every logged in user. If there isn't a sessions table in your localhost database then I'd take another backup of the database and move it to the localhost.

Polly’s picture

Please excuse me. I was being very stupid. I had not browsed to the second page of tables in phpmyadmin!

I have now emptied the sessions table but the problem remains the same.

Polly’s picture

Please excuse me. I was being very stupid. I had not browsed to the second page of tables in phpmyadmin!

I have now emptied the sessions table but the problem remains.

VM’s picture

I've never used the module in question to backup the database. I'd likely take a DB backup from PHPmyadmin and test.

Polly’s picture

Hello VM.

So I made another DB using PHPmyadmin export instead of the module and the error remains the same.

As an experiment I entered garbage into the settings.php database name. And the error remains the same.

I guess this means the error I am seeing is before Drupal even tries to read the DB?

Polly’s picture

I solved this but do not understand why. Just in case this helps anyone in the future...

I took two additional steps to my six steps above:

1) Put site into maintenance mode.
2) Clear all cache, uncheck aggregate CSS/js and select no page cache.
3) Close my admin browser session
4) Make DB backup (using phpmyadmin)
5) Restore DB locally (using cmd line)
6) Copy file system (via FTP)
7) Point settings.php at local database
8) Set correct local file system permissions

And everything worked. I do not know if this success is down to the extra steps I inserted or if I had an error in my first attempt.

cherfakhaled’s picture

Same issue when i transfered a drupal 8 site from local to a remote server.
PHP Fatal error: Class 'Drupal\Core\Session\AccountInterface' not found in srv/data/web/vhosts/sssss.com/htdocs/core/includes/bootstrap.inc on line 62
could you help me resolve this error?

imanoop’s picture

You can install drush 8 from the link https://www.chapterthree.com/blog/installing-drush-8
Or you can Install Drush 8 and Drush 7 Simultaneously from the link https://modulesunraveled.com/blog/install-drush-7-and-8-and-automatically-switch-versions-based-project .

allabakash.g’s picture

Thanks, it was helpful.

amutylo’s picture

Wrong drush version that not support drupal ver 8.x
Reinstall drush with correct version that support drupal ver 8.x

brih’s picture

This is the correct answer, for anyone considering the other steps- you need drush 8.

chaitanya17’s picture

yes, its drush version issue. for Drupal 8 we need to upgrade Drush.

firfin’s picture

Small help, but I believe you are correct with your last assumption (error is early on, even before db access.)

I am experiencing the same error when trying to use drush (same files , so also same drush version, right?) which was working on the server. I get the error after copying it to a local docker setup (both webserver and local running php7.0 )

EDIT:  For me at was also a question of an old drush version. I was trying the use the drush from the docker host machine, instead of the one in dockers php container. Whoops.

rwilson0429’s picture

edit

ReggieW

rwilson0429’s picture

I was able to fix this problem by emptying the session table and all of the cache tables (tables with name beginning with 'cache_').

To empty the session table:

TRUNCATE TABLE session

To empty the cache tables, you can run the following statement in your SQL database:

SELECT concat('TRUNCATE TABLE `', TABLE_NAME, '`;')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'cache_%' AND TABLE_SCHEMA = '[YOUR_DRUPAL_DATABASE]'

This statement will only generate SQL which you need to copy and run yourself.

ReggieW