$cfg- dataroot is not writable

$cfg- dataroot is not writable

by Syed Ali -
Number of replies: 4


After installing moodle successfully, when I open it in browser. I am getting following error message. I gave all writable permissions to dataroot folder but still same issue.

Fatal error $cfg- dataroot is not writable, admin has to fix directory permissions

Average of ratings: -
In reply to Syed Ali

Re: $cfg- dataroot is not writable

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

You also have to make sure it is writable by the correct user. For example, with Centos it needs to be apache, and with Ubuntu it needs to be www-data. On more than one occasion I have gone into the files as root and run into the same problem, usually when I manually installed a plugin.

In reply to AL Rachels

Re: $cfg- dataroot is not writable

by Syed Ali -

I set it to apache on RHEL 7.3 server. Permissions look good, but I have no idea why I am getting error.

In reply to Syed Ali

Re: $cfg- dataroot is not writable

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Syed,
it could be SELinux if still enabled.
If yes, you should also apply the proper context to you moodledata folder:

# SELinux - Allow httpd to read/write to the moodledata directory
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/moodledata(/.*)?"
restorecon -R /var/www/moodledata

Ref.: http://blog.mrverrall.co.uk/2015/10/moodle-on-centos-and-red-hat-7.html

Besides, keep care of properly setting user permissions even when configuring the Moodle cron: https://docs.moodle.org/34/en/Cron#Finding_the_right_place_to_put_the_command

HTH,
Matteo

Average of ratings: Useful (3)