
When you try to install moodle and execute the moodle some time you will face “Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.” this error.This is few ways to solve this error
- Disable SELinux
Disable selinux is one way to solve this problem but i’m not recommend that method
you can disable selinux by editing selinux config file and reboot.
nano /etc/selinux/config and change SELINUX=enforcing
line to SELINUX=disabled or you can temporarily change selinux mode to targeted to permissive using command sudo setenforce 0 but this will change back to targeted after you reboot the server
2.Add SELinux context type
Change selinux context type of the moodledata directory this will solve your problem.
semanage fcontext -a -t httpd_sys_rw_content_t “/var/www/html/moodledata(/.*)?”
restorecon -R -v /var/www/html/moodledata