Drupal Site Stuck Offline? Here's How to Unlock It

Quick instructions for removing offline status in the database

Adapted from: Author: M Butcher Date: 2008-06-25 01:19:24 -0400

Drupal stores information about connecting to your database in sites/default/settings.php. To find out what your database connection information is, open that file and look for the line that starts $db_url =. This line has a string in the following format:
[DB_TYPE]://[USER]:[PASSWORD]@[HOST]/[DATABASE]
The fields in the URL are as follows (the square brackes are just there to demarcate the fields. Do not include them):

[DB_TYPE]: The type of RDBMS you are using. Usually this is mysql.
[USER]: The name of the database user.
[PASSWORD]: The password for the database user.
[HOST]: The domain name or IP address of the server.
[DATABASE]: The name of the database in which Drupal's data is stored.
You may need to use some or all of that information to connect ot the database.

Connecting to the Database

=$ mysql -u [USER] -p --host [HOST] [DATABASE] =

There are two tasks we need to do here:

Delete a cache variable. Change the site status. Task 1: Deleting the Cache

To keep performance high, Drupal makes extensive use of caching. And one thing that gets cached is a map of all of the system-wide variables. This data is stored in a table named, apropriately enough, cache. We want to delete the cache entry whose cid is variables.

mysql> select cid from cache where cid='variables';
+-----------+
| cid       |
+-----------+
| variables |
+-----------+
1 row in set (0.01 sec)

This means you do indeed have cached data, and you will need to delete it. To delete it, enter the following command:

DELETE FROM cache WHERE cid='variables';

This will remove the cache entry.

Task 2: Changing Site Status

In this second task, we will alter the flag that tells Drupal that the site is currently offline. This is handled by an entry in the variable table.

The cache entry we just deleted stored a copy of the contents of the variable table. In this table, we are looking for the entry with the name site_offline. In that entry, we want to change the value from s:1:"1" to s:1:"0".

If you are using the command line, here's what you will need to do.

First, locate the entry:

SELECT name, value FROM variable WHERE name='site_offline';

This will display the record. If no such record exists, your site is either NOT in offline mode or you mistyped the command.

Next, we need to change the value:

UPDATE variable SET value='S:1:"0"' WHERE name='site_offline';

-- RobGardner - 13 Jun 2010
Topic revision: r1 - 13 Jun 2010, RobGardner
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback