5

I moved my site from one server to another in the same way I moved another site. But it won't get out of maintenance mode.

I can access phpMyAdmin and I can access the server files easily.

I've tried /user and /q=user.

Any suggestions?

8 Answers 8

13

There is a few things you can try.

1. Using drush

Go to root of the website and run this drush commands one by one:

drush vset maintenance_mode 0
drush cc all

2. Using database query

Go to phpmyadmin and run this db statement in order to update the "maintenance_mode" property in the variable table to "i:0;":

UPDATE `variable` SET `value` = 'i:0;' WHERE `name` = 'maintenance_mode';

3. Login as admin programatically

Make copy of the index.php file and call it what every want (maintenance.php for example) and at the end of the file replace

menu_execute_active_handler();

with

global $user;
$user = user_load(1);
drupal_session_regenerate();
drupal_goto('user');

go to that file (like [your_website]/maintenance.php), after that just disable maintenance mode and don't forget to remove this file after you finish.

4. Manually set maintenance_mode variable in index.php

Edit index.php file and put

variable_set('maintenance_mode', 0);

just before

menu_execute_active_handler();

5. Configure maintenance mode in settings.php file

At the end of your settings.php file put

$conf['maintenance_mode'] = 0;
4

Just go to /user/login, it works even in maintenance mode, and then sign in as an admin.

1
  • 1
    Since the OP moved the site, this is probably the first step to do. Amazingly, the other answers didn't point out this simple step, which would not even require Drush.
    – apaderno
    Jun 21, 2016 at 6:25
2

Using Drush in D8, one can do:

drush state-set system.maintenance_mode 0

To turn maintenance mode back on:

drush state-set system.maintenance_mode 1
1

And you can also get out maintenance mode by admin/config/development/maintenance under the tab you can able enable or disabled it.

1
  • 1
    Since the OP moved the site, they need to first log in. Then, they can access that page to change the settings.
    – apaderno
    Jun 21, 2016 at 6:44
1

On Drupal 8

If your drush does not have access to mysql but you have access to mysql console you could try this

UPDATE `key_value` SET `value` = 'i:0;' WHERE `name` LIKE '%maintenance_mode%'
1
  • that worked for me.. thanks a lot alex May 29, 2019 at 16:03
0

On Drupal 8.1.1 the following drush commands worked for me:

  • change directory to webroot
  • drush sset system.maintenance_mode 0
  • drush cache-rebuild
  • refresh homepage and login.
0

I've encountered the OP's issue after moving sites from one server to another, and it was because the database didn't fully import.

Compare the list of DB tables on the new server to the list of tables on the old server. If it's incomplete then it's likely you imported the DB through something like PHP MyAdmin and it wasn't fully imported.

You can import off the filesystem with mysql -u username -p dbname < filename.sql, or try using a script like bigdump.php.

You could also try reducing the file size of the imported DB file. Either clean out junk data that you don't need, or export the DB to multiple files with a subset of the tables in each.

0

As of Drupal 9.3.15, go to http://example.com/user/login

And then go to Configuration -> Development -> Maintenance Mode and then uncheck "Put site into maintenance mode"

this has got to be the easiest solution.

but this only works if the user is enabled the "Use the site in maintenance mode". Which is found at Home->Administration->People->System->"Use the site in maintenance mode"

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.