How do you put a Drupal website in maintenance mode via the database?October 22, 2011Matt No Comments »
I recently had a website that we proving quite problematic, it got to the point where I couldn’t even access the Drupal maintenance page without getting memory errors (I suspect the result of a well and truly oversold shared server). It became necessary that when migrating it to a new server, to ensure there were no sales or anything like that get missed, to put it in maintenance mode somehow.
After a bit of hunting around, I came across two options, one via PHPMyAdmin, and another that required shell access. On this particular server, I did not have shell access, but I did have access to PHPMyAdmin (though changes made there only seemed to actually take effect about 33% of the time).
Pixel Play had a great little run down of the necessary SQL commands to both put the site in maintenance mode, and to take it out of.
Enter maintenance mode via PHPMyAdmin
Simply enter the following SQL into the query box for your database in PHPMyAdmin to put a Drupal website into maintenance mode:
UPDATE variable SET value = 's:1:"1";' WHERE name= 'site_offline'; DELETE FROM cache WHERE cid = 'variables';
Exit maintenance mode via PHPMyAdmin
Just as simply, enter the following SQL into PHPMyAdmin to bring a Drupal website back online, or out of maintenance mode:
UPDATE variable SET value = 's:1:"0";' WHERE name= 'site_offline'; DELETE FROM cache WHERE cid = 'variables';