MilesWeb Hosting Forum

Please login or register.

Login with username, password and session length



SMF - Just Installed!

Author Topic: Moodle Error:- Fatal error: $CFG->dataroot is not configured properly,  (Read 13732 times)

0 Members and 1 Guest are viewing this topic.

Offline Dipak Bhoi

  • MilesWeb Team Member
  • Full Member
  • ***
  • Posts: 208
  • Karma: +5/-0
    • View Profile
    • MilesWeb Internet Services
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.
cPanel Hosting in India - cPanel Hosting in India.

Grab an SSL for your website and SAVE 20% now. Coupon Code SSLSAVE20.

MilesWeb Hosting Forum