问题
I configured moodle but I'm getting an error message:
Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.
My moodle directory is in var/www/html/moodle
and in my moodle/config.php
is $CFG->dataroot = '/var/moodledata';
Still nothing works when I try to start moodle. What can be done about it?
回答1:
I think the moodledata folder does not have write permission. provide 0777 permission to the folder then it should be accessible.
回答2:
You should first create that directory and give access to the user that run the web server to this directory. on centos/redhat:
chown apache.apache /var/moodledata
Note that on centos/redhat there is a good chance that SELINUX is blocking the web server process to access /var/moodledata directory. The easy way to check it is to disable it (temporarily) by typing:
setenforce 0
service httpd restart
Then if in this way it works - set it to allow access to this directory and the re-enable it in this way:
setenforce 1
if you want to disable selinux completely, then edit /etc/selinux/config and set this line:
SELINUX=disabled
on debian/ubuntu the ownership should be like this:
chown www-data.www-data /var/moodledata
回答3:
Moodle does need to create and delete files within its working folder. If the folder owner is Apache
, then you actually only need 700
permissions and can ignore the group. Otherwise you have to set 770
permissions to all directories in moodledata
and 660
to all files in moodledata
folder.
The critical thing is to make sure that the moodledata
folder is NOT in any web accessible area (http root). If your http root is /var/www/html
, then make it /var/moodledata
.
来源:https://stackoverflow.com/questions/31138846/why-is-moodle-not-available