-
Sub-task
-
Resolution: Fixed
-
Minor
-
1.8.2
-
None
-
MOODLE_18_STABLE
-
MOODLE_20_STABLE
The installer script doesn't tolerate symlinks when checking if $CFG->dirroot is valid.
Lets say Moodle folder is on a separate volume, but symlinked in the DocumentRoot:
/var/www/html/moodle -> /mnt/moodle/moodle_1.8.2
Apache is set with DocumentRoot to /var/www/html/, and Moodle with $CFG->dirroot to /var/www/html/.
In this instance, the following check during install will fail (/admin/index.php, line 79):
$dirroot = dirname(realpath("../index.php"));
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
realpath() will retrieve the "real path" to the index.php, in this case /mnt/moodle/moodle_1.8.2, and comparison with
/var/www/html will fail.
I recommend a minor change to the code:
$dirroot = dirname(realpath("../index.php"));
$cfg_dirroot = dirname(realpath($CFG->dirroot . "/index.php"));
if (!empty($dirroot) and $dirroot != $cfg_dirroot) {
This will expand both paths to their physical paths, and compare /mnt/moodle/moodle_1.8.2==/mnt/moodle/moodle_1.8.2