# CFG error on website

**URL:** <https://forum.infinityfree.com/t/cfg-error-on-website/83050>\
**Category:** Hosting Support\
**Created:** [September 22, 2023, 2:15am UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050 "2023-09-22T02:15:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajgupta6969](https://forum.infinityfree.com/letter_avatar/rajgupta6969/32/6_449c533f586939b6e5f246632a46421f.png) [@rajgupta6969](https://forum.infinityfree.com/u/rajgupta6969)\
**Post date:** [September 22, 2023, 2:15am UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/1 "2023-09-22T02:15:16Z")

</div>

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

I checked cfg dataroot path it’s completely right but when I visit my site it’s showing this type of error. How can I solve it??

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [September 22, 2023, 4:57am UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/2 "2023-09-22T04:57:03Z")

</div>

> [@rajgupta6969](#):
>
> How can I solve it??

No idea. You have to provide more info

---

<div class="post-metadata">

**Author:** ![anon95807532](https://forum.infinityfree.com/letter_avatar/anon95807532/32/6_449c533f586939b6e5f246632a46421f.png) [@anon95807532](https://forum.infinityfree.com/u/anon95807532)\
**Post date:** [September 22, 2023, 6:10am UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/3 "2023-09-22T06:10:22Z")

</div>

Hi @rajgupta6969,

> [@rajgupta6969](#):
>
> Message-Fatal error: $CFG-\>dataroot is not configured properly, directory does not exist or is not accessible! Exiting.

From the error message, I guess you’re trying to install the learning platform moodle on your free hosting.

Most cases that I encounter regarding this error message are something related to your config.php needing to check the absolute path set in $CFG-\>dataroot, or it’s permission settings.

This link on the moodle support forum may be of help:  
[https://moodle.org/mod/forum/discuss.php?d=370441](https://moodle.org/mod/forum/discuss.php?d=370441)

Let us know how things went.

Cheers!

---

<div class="post-metadata">

**Author:** ![rajgupta6969](https://forum.infinityfree.com/letter_avatar/rajgupta6969/32/6_449c533f586939b6e5f246632a46421f.png) [@rajgupta6969](https://forum.infinityfree.com/u/rajgupta6969)\
**Post date:** [September 24, 2023, 10:47am UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/4 "2023-09-24T10:47:50Z")

</div>

yes , you are right. i installed moodle using softaculous installer. its working fine but suddenly its showing this error and i can’t solve it. i also checked config.php path and moodledata folder permission but its still not working.

---

<div class="post-metadata">

**Author:** ![rajgupta6969](https://forum.infinityfree.com/letter_avatar/rajgupta6969/32/6_449c533f586939b6e5f246632a46421f.png) [@rajgupta6969](https://forum.infinityfree.com/u/rajgupta6969)\
**Post date:** [September 24, 2023, 2:33pm UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/5 "2023-09-24T14:33:38Z")

</div>

hello, i need help about this problem -  
Fatal error: $CFG-\>dataroot is not configured properly, directory does not exist or is not accessible! Exiting.

i installed moodle using softaculous installer but this error show everytime. i delete everything from my website and install it again and same error showing. i tried to host other html files its working find but this moodle is not working. i also checked config.php and path of dataroot there is no issue. and also giving moodle folder permission 777. idk what is the issue please check it what is issue.

here some images:  
1  
 ![image](https://forum-cdn.infinityfree.net/original/3X/8/9/89879bdbfe64e5ae7d27e7681c1b5aae40c1b8c5.png)  
2

 ![image](https://forum-cdn.infinityfree.net/original/3X/0/f/0fc8a27b17ace8006a310e01a1b7ac949058cc4f.png)  
3  
 ![image](https://forum-cdn.infinityfree.net/original/3X/8/6/86eb3c42acdf6589f8343fa2201a11061890b159.png)

---

<div class="post-metadata">

**Author:** ![anon42008019](https://forum.infinityfree.com/letter_avatar/anon42008019/32/6_449c533f586939b6e5f246632a46421f.png) [@anon42008019](https://forum.infinityfree.com/u/anon42008019)\
**Post date:** [September 24, 2023, 5:13pm UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/6 "2023-09-24T17:13:00Z")

</div>

Dataroot has to be inside `htdocs` folder, anything outside htdocs is inaccessible by the php program.

---

<div class="post-metadata">

**Author:** ![ChrisPAR](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/chrispar/32/8743_2.png) [@ChrisPAR](https://forum.infinityfree.com/u/ChrisPAR)\
**Post date:** [September 24, 2023, 5:32pm UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/7 "2023-09-24T17:32:11Z")

</div>

Moodle is a bit tricky to work with. As said above by @anon42008019, the `moodledata` folder needs to be inside `htdocs`, so the last part of `$CFG->dataroot` needs to also be configured to `/htdocs/moodledata` instead of just `/moodledata`:

> [@Moodle Installation problem](https://forum.infinityfree.com/t/moodle-installation-problem/73929/2):
>
> Hi and welcome to the forum Apologies for the late reply Scripts can only write to the htdocs directories they are in. Any directories outside the htdocs dir cannot be written - due to the open\_basedir restriction. The reason why this is happening to you is: Moodle requires a directory to store data that should not be web-accessible. However, for security reasons, software on free hosting is blocked from accessing anything outside its own website folder. So Moodle cannot work with the way se…

There’s a chance you may face an issue with the default session storage setting as well, in which case you also need to follow the steps here:

> [@Disk quota exceeded (122) error when working with Moodle](https://forum.infinityfree.com/t/disk-quota-exceeded-122-error-when-working-with-moodle/75732/12):
>
> Try adding the following two lines to your config.php file (below what should be line 25, $CFG-\>directorypermissions = 0777; line) $CFG-\>session\_handler\_class = '\core\session\file'; $CFG-\>session\_file\_save\_path = session\_save\_path(); [https://docs.moodle.org/26/en/Session\_handling#Files](https://docs.moodle.org/26/en/Session_handling#Files)

---

<div class="post-metadata">

**Author:** ![rajgupta6969](https://forum.infinityfree.com/letter_avatar/rajgupta6969/32/6_449c533f586939b6e5f246632a46421f.png) [@rajgupta6969](https://forum.infinityfree.com/u/rajgupta6969)\
**Post date:** [September 25, 2023, 5:31pm UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/8 "2023-09-25T17:31:58Z")

</div>

i tried but after moving moodledata folder in htdocs and changed path in cofing.php (/home/vol6\_4/epizy.com/epiz\_33844728/htdocs/moodledata’) its showing new error on website.

![image](https://forum-cdn.infinityfree.net/original/3X/8/b/8bee90e0982af844aa01c7a4f4da148300db2641.png)

is there any other way to get access folder outside of htdocs folder or run moodle on free hosting?

---

<div class="post-metadata">

**Author:** ![anon95807532](https://forum.infinityfree.com/letter_avatar/anon95807532/32/6_449c533f586939b6e5f246632a46421f.png) [@anon95807532](https://forum.infinityfree.com/u/anon95807532)\
**Post date:** [September 26, 2023, 5:13pm UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/9 "2023-09-26T17:13:46Z")

</div>

Hi rajguota6969,

This simply means moodle has thrown an Exception somewhere in their code, you might want to check with the error log if you have enabled this in your php settings.

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [October 3, 2023, 5:13pm UTC](https://forum.infinityfree.com/t/cfg-error-on-website/83050/10 "2023-10-03T17:13:56Z")

</div>

Closed on October 3, 2023, 5:13pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
