[pmwiki] Re: [Pmwiki-users] upload trouble with pmwiki 0.6.7

Bronwyn Boltwood arndis
Wed Mar 17 15:55:12 CST 2004


I found out how to fix my upload problem, and am posting it (1) for the benefit 
of others, and (2) in case I ever forget.  

After learning how to turn on PHP error reporting, I found out that uploading a 
file to the default group gives: 
Fatal error: Call to undefined function: posix_getegid() in 
/www/ag/a/arndis/wiki/pmwiki.php on line 292

SDF's config does not allow me to set UID or GID.  I then tried the chmod 777 
umask(0) trick from PmWiki.ErrorMessages, but that got me

Warning: mkdir(uploads/Aerie/): No such file or directory in 
/www/ag/a/arndis/wiki/pmwiki.php on line 302
PmWiki can't process your request
Cannot create uploads/Aerie/
Current directory is /www/ag/a/arndis/wiki
We are sorry for any inconvenience.
http://www.pmichaud.com/ref/PmWiki/Mkdir

So I added upload directories for each group by hand.  Experiment showed that 
reverting to sane permissions and removing umask(0) did not break uploads.  
Since suPHP will make any attached files belong to me anyway, I decided to use 
$ForceMkdir=1; in config.php.

Point #1: 
Anytime PmWiki needs SUID or GUID to do something (usually making a directory) I 
am probably screwed.  Is $ForceMkdir=1 the solution to this problem for 
everything, or just for uploads?  

Point #2:
While testing, I found that it would be really helpful to get an error when 
trying to upload too big a file. Since I'm the wiki admin, I kept thinking I 
could do anything I wanted and forgot about the size limits I myself had set!  

Sample error: "The wiki administrator has decided that *.zip attachments must be 
under x KB.  The file you are trying to attach is y KB."  Wiki administrator 
could be a mailto: link based on a variable in config.php.

Bronwyn






More information about the pmwiki-users mailing list