Recently one of my development Moodle site stuck up in the maintenance mode due to which I was not able to see any page on my Moodle site. A quick search on Moodle forums brought up so many tricks to restore the site back which I thought to share with all of my fellow readers.
The steps which you can take to restore your site back are:
- Appending ‘/login/index.php’ in the URL of your site name – If you add ‘/login/index.php’ in the site URL then you can access the login page of your Moodle site e.g. if your site is running with a domain name http://yourdomainname.com then you can directly type http://yourdomainname.com/login/index.php in the address bar of your browser. It will allow you to login into your Moodle site and turn off the maintenance mode in the settings through Site Administration > Server > Maintenance Mode.
- Directly trying the URL – http://yourdomainname.com/admin/settings.php?section=maintenancemode which will again takes you to the login page and then redirects you to the maintenance page where you can turn off the maintenance mode.
- Through Command line (CLI) –
php maintenance.php --disable
- Through Database – If you have database access then also you can deactivate the maintenance mode by changing the variable named “maintenance_enabled” to “0” in the “mdl_config table“. (that’s a zero. 1 is on)
- Editing the config.php file – If you have access to your config.php file then you can add the following line in your config.php file:
$CFG->maintenance_enabled=0; (that's a zero and be sure to include the ';' at the end of that line.
Also check for a file maintenance.html in the Moodledata directory and delete it.
These are the different tricks which I collected during my search on Moodle forums. If you are still stuck up in the maintenance mode then better post a new thread in the Moodle forums or else share your tips in comments and I will update the article.