## General help

### Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting. Re: Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Hi Dexter

You need to give dataroot folder 777 permission where your all data is stored. Please give this permission with terminal so that all files and folders inside data folder are writeable

Average of ratings: -
Re: Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting. Hi Sakshi, Good day! Thank you for the response. We've already set the permission of the moodledata folder to 777 long before we've encountered the problem. What we don't understand is that it displays the "Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting." error and the server is unresponsive/freezes so we have to restart the server. Could it be that the hardware (server) that is causing the "Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting." error since its unresponsive and Moodle cannot access the dataroot folder? Thanks Average of ratings: - Re: Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Thanks for complete description of system.

Question:  the moodledata directory might be on a partition of it's own (/data).  The 'df' command will show all partitions/devices.

If Moodle is set to use files for session information that attempts to write a session file to moodledata/sessions/.  Can change that behavior by editing config.php and adding: $CFG->dbsessions=1; That will use DB for session information. Typically, DB files are on/in /var/ Is apache server still running? ps aux |grep httpd Check logs: dmesg | less Might check CentOS forums for such situations where system mounts a partition as ro. http://bit.ly/1eD0Qdi 'spirit of sharing', Ken Average of ratings: - Re: Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Knowing CentOS, I would bet very large amounts of money that this is a SELinux issue.

CentOS ships with very tight SELinux rules by default. One of those rules prevents Apache and PHP from accessing files outside the webroot, which is where your moodledata folder will be.

Average of ratings: Useful (1)
Απάντηση: Re: Fatal error: \$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Indeed, it's a SELinux issue. I had met the same problem..

If you don't want to disable SELinux at all, you can run the following command:

chcon -R -t httpd_sys_content_t /path_to/moodledata

This sets SELinux to allow apache to write to the directory.

Andreas

Average of ratings: Useful (1)