Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.4.1
-
Fix Version/s: None
-
Component/s: General
-
Labels:None
-
Environment:Linux
-
Affected Branches:MOODLE_14_STABLE
Description
Hi!
This is a pseudo bug... I was trying to solve the problems with moodle and php in SAFE_MODE.
I will present here a receipt to make moodle work with SAFE_MODE:
1) on php.ini set:
safe_mode = On
safe_mode_gid = On
2) Assuming apache is running with apache/apache (uid/gid), and moodle is installed as moodle/moodle do:
mkdir $CFG->dataroot
chown moodle.moodle $CFG->dataroot
chmod 2777 $CFG->dataroot
3) On config.php, set:
$CFG->directorypermissions = 02777;
4) Apply the patch bellow
diff -uNr lib/moodlelib.php.orig lib/moodlelib.php
— lib/moodlelib.php.orig Wed Sep 29 08:19:56 2004
+++ lib/moodlelib.php Thu Oct 14 20:06:18 2004
@@ -1750,7 +1750,7 @@
}
return false;
}
- @chmod($currdir, $CFG->directorypermissions); // Just in case mkdir didn't do it
+// @chmod($currdir, $CFG->directorypermissions); // Just in case mkdir didn't do it
}
}
The 2 in that 02777, sets the gid on the dir which afects the creation of any file or subdirectory to
inherit the group id from its parent. This way all files and subdirectories stored under $CFG->dataroot will be apache.moodle not causing the problems frequently reported.
The cause of the patch is to remove the chmod after creation, because if we try to set permissions after creation SAFE_MODE only allow us to set gid bit to something with apache group.
Until the moment it runs ok with this recipe for me!
Hope this helps.
Cheers,
Paulo Matos
bit
From Paulo Matos (paulo.matos at fct.unl.pt) Friday, 15 October 2004, 04:13 PM:
Someone has posted this problem has a php bug, developers however didn't consider it so, see it on:
http://bugs.php.net/bug.php?id=24604&edit=3
From Paulo Matos (paulo.matos at fct.unl.pt) Wednesday, 20 October 2004, 07:16 PM:
I checked against latest cvs version of moodlelib.php (v 1.391 2004/10/17 23:44:16) and problem still persists.
From Martin Dougiamas (martin at moodle.com) Thursday, 21 October 2004, 12:23 AM:
Thanks, this will be in 1.5
From Martin Dougiamas (martin at moodle.com) Sunday, 26 December 2004, 10:48 PM:
These patches have been made in 1.5 CVS (except your step 2 of course which is manual and needs to be mentioned in documentation, I guess).
I've not tested these but they make sense.
From Tony Hursh (hursh at uiuc.edu) Monday, 24 January 2005, 12:24 PM:
This may be causing some problems with Mac OS X. See
MDL-2411.I'm not 100% positive that this is causing it, though. More later.....
From Tony Hursh (hursh at uiuc.edu) Thursday, 10 February 2005, 05:39 AM:
Maybe a best of both worlds approach would to change the code that generates config.php to something like this pseudo-code:
if (safe mode detected)
use 02777 for $CFG->directorypermissions;
warn user that he needs to do the chown/chmod stuff for his data folder
else
use 0777 for $CFG->directorypermissions;
The other changes in the patch don't seem to cause any problem as long as $CFG->directorypermissions is set to 0777.
Over in
MDL-2411, Eloy said he thought the problem might be due to the setgid bit not propagating to subdirectories. If I get a chance I'll see if I can confirm that.MDL-2411. I'm not 100% positive that this is causing it, though. More later..... From Tony Hursh (hursh at uiuc.edu) Thursday, 10 February 2005, 05:39 AM: Maybe a best of both worlds approach would to change the code that generates config.php to something like this pseudo-code: if (safe mode detected) use 02777 for $CFG->directorypermissions; warn user that he needs to do the chown/chmod stuff for his data folder else use 0777 for $CFG->directorypermissions; The other changes in the patch don't seem to cause any problem as long as $CFG->directorypermissions is set to 0777. Over inMDL-2411, Eloy said he thought the problem might be due to the setgid bit not propagating to subdirectories. If I get a chance I'll see if I can confirm that.