As much as I liked NearlyFreeSpeech.net when I joined up with them, I didn't realise what a bind having safe_mode turned on would be when trying to upload audio files.
Anyhow, if anyone else is in a similar situation, and gets error messages along the lines of warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File(/var/tmp/) is not within the allowed path(s): when you try to upload audio, this might help you a little:
- Look for file modules/audio/getid3/getid3/write.id3v2.php
- Make a backup
- Edit the file, look for line 84, with the expression if ($tempfilename = tempnam('*', 'getID3'))
- Change this to if ($tempfilename = tempnam('tmp', 'getID3')) - where tmp is a folder in your drupal installation
- That should get rid of the original error message. It did for me.
However - you might now be confronted by a new error message - this time due to use of the copy() function , which doesn't seem to work too well under safe_mode.
I'll post back if I can find out how to hack that too. I hate dutty hacks.
Comments
If you go to Administration
If you go to Administration -> Site Configuration -> File System and set the Temporary Directory to "../tmp" it should fix your problems.
I had to changed elsewhere, but it WORKS. Thanx rob101!
My warning message:
- Look for file modules/audio/getid3/getid3/getid3.lib.php
- Make a backup
- Edit the file, look for line 1158, with the expression if ($tempfilename = tempnam('*', 'getID3'))
- Change this to if ($tempfilename = tempnam('tmp', 'getID3')) - where tmp is a folder in your drupal installation
- That should get rid of the original error message. It did for me.
It isn't pretty, but the hack
It isn't pretty, but the hack will get around the problem. The issue seems to be getid3.lib.php trying to manipulate files in the system's temp directory, when all you can do is move the file out of there once it has been uploaded.
To solve the problem, it might be useful to be able to supply a temp path to getid3. That way the Drupal module could tell getid3 where its temp directory is.
Alternatively, if PHP's upload temp directory is listed in open_basedir, line 1158 of getid3.lib.php could be something like this:
perms and /tmp on nearlyfreespeech.net
At https://members.nearlyfreespeech.net/wiki/Applications/Drupal there is explanation of how to setup on NFS with Drupal. I haven't done extensive testing (and I'm new to Drupal), but this seemed to fix my permission problems, except for the tmp thing.
I created a "tmp" in the "protected" dir and made sure it was in group "web", then chmod g+w on it (so it's rwx for group web).
In my site configuration -> file system I entered "/f5/mysitename/protected/tmp" as the temp dir and it seems things are working now.
The actual value for the first bit of that path can be found on the site info page under "Apache Site Root". I'm sure the "f5" bit varies, and of course "mysitename" is the NFS site name.
it is good
it is good
warning: unlink() [function.unlink]: SAFE MODE Restriction in effect. The script whose uid/gid is 5082/5000 is not allowed to access /var/tmp/getID34FV9nF owned by uid/gid 80/0 in /vol0/web/o/ofcn.cz/www.ofcn.cz/doc_root/sites/all/modules/getid3/getid3/getid3.lib.php on line 1164.
- Look for file modules/audio/getid3/getid3/getid3.lib.php
- Make a backup
- Edit the file, look for line 1158, with the expression if ($tempfilename = tempnam('*', 'getID3'))
- Change this to if ($tempfilename = tempnam('tmp', 'getID3')) - where tmp is a folder in your drupal installation