Does anyone know how to turn off maintenance mode for brainfx? I tried http://www.website.com/?q=user/login but that gives me a blank page (no html source or anything). I tried the following query.

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

It didn't affect any records.

I tried to find a $conf['maintenance_mode'] variable in the project, but it doesn't exist. Adding that $conf['maintenance_mode'] = false; in setting.php didn't do anything either.

How do I turn off maintenance mode?


Using Drush, you can run drush vset maintenance_mode 0 to disable the maintenance mode on a Drupal 7 site.


The answer by schnippy is correct; however, some details are wrong, at least in Drupal 7.28.

The query to change maintenance_mode should be:

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

The value is an integer, even if a string might work as well. It's just not what Drupal itself uses.

More importantly, in order to reset the cache for maintenance_mode, the table to use is cache_bootstrap.

DELETE FROM cache_bootstrap WHERE cid = 'variables';

There is no cache with ID equal to variables, inside the cache table.

This is tested and works with Drupal 7.28.

  • 1
    This is correct. Although the serialized string will also generally work because this value is usually checked using the equals operator instead of the identical one this way is safer.
    – rooby
    Nov 17 '14 at 5:26

You're on the right track with the database approach but your query is wrong since the variables are serialized. The actual syntax is:

UPDATE variable SET value = 's:1:"0";' WHERE name= 'maintenance_mode';

Also - its a good idea to follow this by flushing the variables cache:

DELETE FROM cache WHERE cid = 'variables';
  • 1
    +1 for the suggestion of flushing the cache, since the values of persistent variables are cached.
    – apaderno
    Jan 22 '14 at 21:36

Maintenance mode is triggered by the variable "maintenance_mode", which is set to 1 when activated.

This is the code present in the System module (system.admin.inc, line 2194).

 * Form builder; Configure the site's maintenance status.
 * @ingroup forms
 * @see system_settings_form()
function system_site_maintenance_mode() {
  $form['maintenance_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put site into maintenance mode'),
    '#default_value' => variable_get('maintenance_mode', 0),
    '#description' => t('When enabled, only users with the "Use the site in maintenance mode" <a href="@permissions-url">permission</a> are able to access your site to perform maintenance; all other visitors see the maintenance mode message configured below. Authorized users can log in directly via the <a href="@user-login">user login</a> page.', array('@permissions-url' => url('admin/people/permissions'), '@user-login' => url('user'))),
  $form['maintenance_mode_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Maintenance mode message'),
    '#default_value' => variable_get('maintenance_mode_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))),
    '#description' => t('Message to show visitors when the site is in maintenance mode.')

  return system_settings_form($form);

You can use drush to disable maintenance mode.

drush vset maintenance_mode 0;
drush cc all;

You can also use variable_set('maintenance_mode', 0) and clear cache afterwards (with a call to cache_clear_all()).

  • 1
    Drush for everything :) I'm glad you added the drush command to do it. Jan 23 '14 at 2:47

I had the same issue, however: every solution here above mentioned didn't work. the only thing that solved it to me was running the cron:

  • Logging in to the site with the Admin user
  • Go to the Menu Configuration -> Cron -> Run cron.

after that site was back up.


If you remember your username and password, login from http://www.example.com/?q=user. Then go to Configuration >> Maintenance mode; uncheck Put site into maintenance mode, and save.


With the latest version of Drush/Drupal the command has changed:

drush state:set system.maintenance_mode 0 --input-format=integer
drush cache:rebuild

Drupal documentation


In my case, Drush was not working and I could bring back the site by doing this:

Add the below line in docroot\core\lib\Drupal\Core\EventSubscriber\MaintenanceModeSubscriber.php

\Drupal::state()->set('system.maintenance_mode', FALSE);

Run the site again for 2-3 times (clearing the cache) and it is up again.

Remember to take out this line once your site is up

  • 1
    Please don't do this
    – baikho
    Mar 23 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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