LMSouq
moodle-core Open

Error installing moodle. Dataroot location is not secure and Parent directory (/var) is not writeable.

SE
seeker
1 month ago
3 views
Problem Description
I'm trying to install moodle but I come across an error in the process, when I specify the path to the moodle data folder. Basically they want it be at a place where it cannot be accessed from the web. I've tried placing it in `/var/moodledata` which gives me an error saying ` Parent directory (/var) is not writeable. Data directory (/var/moodledata) cannot be created by the installer.` and at `/var/www/moodledata` which gives me an error saying `Dataroot location is not secure` I tried giving sudo(permissions) to the `/var/www/` folder and also tried hacking `install.php` to skip the validation by commenting out the following lines /*while(is_dataroot_insecure()) { $parrent = dirname($CFG->dataroot); $i++; if ($parrent == '/' or $parrent == '.' or preg_match('/^[a-z]:\\\?$/i', $parrent) or ($i > 100)) { $CFG->dataroot = ''; //can not find secure location for dataroot break; } $CFG->dataroot = dirname($parrent).'/moodledata'; }*/ and /* do { if ($CFG->dataroot !== '') { $prompt = get_string('clitypevaluedefault', 'admin', $CFG->dataroot); } else { $prompt = get_string('clitypevalue', 'admin'); } echo $error; $CFG->dataroot = cli_input($prompt, $CFG->dataroot); if ($CFG->dataroot === '') { $error = get_string('cliincorrectvalueretry', 'admin')."\n"; } else if (is_dataroot_insecure()) { $CFG->dataroot = ''; $error = get_string('pathsunsecuredataroot', 'install')."\n"; } else { if (install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) { $error = ''; } else { $a = (object)array('dataroot' => $CFG->dataroot); $error = get_string('pathserrcreatedataroot', 'install', $a)."\n"; cli_error(get_string('pathsunsecuredataroot', 'install')); } } } while ($error !== '');*/ } /*else { if (is_dataroot_insecure()) { } if (!install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) { $a = (object)array('dataroot' => $CFG->dataroot); cli_error(get_string('pathserrcreatedataroot', 'install', $a)); } }*/ However, I havent had any success . Any idea on how I could over come this would be appreciated!

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base