MilesWeb Hosting Forum

Web Hosting Technical Support => Errors and Solutions => Topic started by: Dipak Bhoi on November 17, 2014, 09:50:21 AM

Title: Moodle Error:- Fatal error: $CFG->dataroot is not configured properly,
Post by: Dipak Bhoi on November 17, 2014, 09:50:21 AM
Hello Guys,

Yesterday, suddenly our few customers were facing issues with their Moodle site. They were getting a below mentioned error while browsing their Moodle site.

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

After investigating about the issue, I found that after Enabled php open_basedir on server they got that error. This error for only on Moodle site, all other sites was working fine.

As per error it's showing that " dataroot is not configured properly ". So I checked the configuration file of particular moodle's site and found the root cause. open_basedir is restricting access to directory outside of public_html.  Follow the below steps to resolved this error.

1. Login to your server as a root user.

2. Open the configuration file of moodle.

#vi config.php

3. check for the variable $CFG->dataroot, value should be /home/your-user-name/public_html/moodledata'; instead of /home/your-user-name/moodledata.

4. Instead of disable the open_basedir on the server move the moodledata directory to public_html and correct the path in dataroot in configuration file.

5. That's all, after correct the path you should be able to access the site.