Moodle 3 returned to Install page after being configured and working

Moodle 3 returned to Install page after being configured and working

by Geoff Rochester -
Number of replies: 3

Hi,

Context:

I installed Moodle 3.1.2 (build 20161027)  on a remote web hosting server several weeks ago. It was all up and running and had a couple of courses and users added. 


Issue:

Today I logged in to find I was being automatically redirected to the Install page and was requesting all the setup information (Name of site/ database path etc). The config.php file seemed all ok and pointing to the correct SQL database and all data was present in the database.


Im not sure what happened and why Im being directed to the install page. I tried manually tying in the home page but it continued to redirect me. 

Fortunately I don't have any student data to worry about yet but it would be nice to get the site and course layout back


Any suggestions to fault find why this may be doing this and what I could do to get back the missing setup and schools.

Any direction would be great

Regards Geoff


Average of ratings: -
In reply to Geoff Rochester

Re: Moodle 3 returned to Install page after being configured and working

by Ken Task -
Picture of Particularly helpful Moodlers

About the only way that might happen is when Moodle can't find/read a config.php file.

So ... check the moodle code directory for a config.php file.

Is it readable by all?

If no config.php file, contact hosting provider ... hopefully, they have a backup of your site and could restore the config.php file. ** see below

Failing that, one last chance ... but it involves a little mysql and editing in re-creating a config.php file from the config-dist.php file that should still be in the code directory.

First, gather some information concerning the DB ... remotely hosted systems usually have some tool installed for customers to do that.   You need: DB host, DB name, DB user, DB Password.

Use a mysql query tool to view the contents of the mdl_config table.

That should contain all the variables that were in the original config.php file that you could manually insert into a copy of config-dist.php which you *copy* to config.php.    You'll see lines like:

$CFG->dbhost    = in a copy of that config-dist.php file now called config.php.

The value would be enclosed inside the 'ticks' and each config line would end with a 'semicolon' (;).

The following for typical mysql on linux:

$CFG->dbtype    = 'mysqli';      // 'pgsql', 'mariadb', 'mysqli', 'mssql', 'sqlsrv' or 'oci'
$CFG->dblibrary = 'native';

Web site location

$CFG->wwwroot   = 'http://example.com/moodle'; (url to your moodle site)

Full path to the moodledata directory:

$CFG->dataroot  = '/home/example/moodledata';

The above is an example ... can't copy and paste it.

The rest of the config.php building you could skip.

Make sure it's readable by the globe.

Then try hitting site with browser.

** see above ... would be by ar the easiest way to fix! ;)

'spirit of sharing', Ken

In reply to Ken Task

Re: Moodle 3 returned to Install page after being configured and working

by Geoff Rochester -
Thanks for your reply Ken,


Yes the config.php was readable and seemed to be pointing to all the right places. But I recreated a new config file anyway which I couldn't see any difference between the two and it worked and got me back into the moodle site but no data was available. 

I found out that my hosting provider just retired an old server and moved all services over to a new server. It seems that in the process they copied over a blank database and the only backups I have are now of the blank database.

I haven't managed to get my data back but at least I know why it happened. Guess I will be forced to make my own database backup each night.


All this doesn't really explain the original issue of moodle diverting to the install page though. Must have had a slight corruption in the config.php file.


Thanks again for your help.

In reply to Geoff Rochester

Re: Moodle 3 returned to Install page after being configured and working

by Ken Task -
Picture of Particularly helpful Moodlers

config file is very sensitive .... ticks, ending ";", no closing php tag ... and it's true, there might have been something errant that you could not see ... none displayable character ... a space is one of those so are CR CR/LF's

Without actually seeing the backups compared to what was present when you discovered the issue, I'd be capable of a "Vulcan Mind Meld"!     Uhhhh .... have never meet Spock to have never been taught - and even if I were, ...  well, you get the gist.

So provider lost your backup of your DB.    Hmmmmm ... that would make one un-easy ... large withdrawal from the 'bank of trust' ... so yeah, think I'd backup on a regular basis.

Since Moodle needs a DB that that be the explanation.   Don't think Moodle is an app that actually creates the DB for you upon installation.

Well, it's good that you didn't loose a years with of work ... classes.

'spirit of sharing', Ken