Php Safe Mode & 777 Directories

liunx

Guest
Hi,<br />I wanted to know if it was possible to run Coppermine (which uses PHP) and create directories that are not 777. I am having problems if I want to limit the permissions.<br /><br />Also is the reason why files/directories created with php can't be deleted because it's ruuning in Safe Mode?<br /><br />Thx,<br />-Jorge<!--content-->
When you use a PHP scipt to create a directory or file you will not be the owner of the directory or file it creates because the script does not run as you. You could write a PHP script that will delete the directories and files you create with another PHP script.<br /><br />Oh, and welcome to the family! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Thanks.<br />You answered the 2nd question fully. I was pretty sure that was the answer from reading other posts but wasn't 100% sure. I can use CPG to delete the files (I actually should to remove entries from MySql as well). But wouldn't that php script to delete the files be accessible by everyone? (I will post in the CPG support forum how the CPG user accts are handled).<br /><br />I still would like to know about my 1st question, Coopermine said that the albums directory should be either 755 or 777 for it to work. (depending on server configs)<br /><br />755 I am comfortable with but not 777. CPG doesn't work fully (can't upload pics in batch mode) in 755 w TCH though, and it requests 777. In Unix, with 777 any user can delete the dir. I don't want visitors to be able to delete the albums? How could I pervent it short of making the albums private? (.htaccess)<!--content-->
Welcome to the family, Jorge! Thumbs Up<br /><br />As for your question regarding directory permissions and coppermine, the problem is that when coppermine (PHP) needs to write stuff into those directories, since it is not running as your user but the directory is owned by your user, coppermine can't write into it.<br /><br />The solution is to either make the directory belong to the group to which the PHP/Apache user belongs and set its permissions to 775<br />or<br />make the directory writable for anyone.<!--content-->
Well, unfortunately, 755 won't work, because that means only your user will have write access to the directory but since PHP/Apache are running under another user, they won't be able to write to the directory, which is not what you want.<br /><br />The other solution I proposed above also has the disadvantage that anyone could *theoretically* delete any file that has group-write permissions.<br /><br />I say theoretically because it's quite hard for someone to do that, since they need to know the username of another user on the same server, which is not publicly available. Besides, I believe TCH has recently activated some configuration options in PHP that make this even harder.<br /><br />In practice, I don't think we have ever assisted a situation where a user has deleted files from another user, so don't worry too much about it <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Gracias Raul,<br /><br />Thanks for the quick 2nd repply. I was just about to write and ask if my understanding of 775 was correct, since all the users 'share' PHP. <br /><br />I will leave it as 777. Just something in my spine jumped when I saw 777. It is the 1st no-no that we are always told.<br /><br />Anyways thanks a lot, currently my CPG is 'private' while I make all the tests and make sure the config is right. Just didn't want to make it public, while I still had access questions.<br /><br />Thx again,<br />-Jorge<!--content-->
Welcome to your extended family <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br />There is a lot of coppermine users in this forum, so no question should be to tough to answer. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
No problem, Jorge <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />And as Thomas said, we have a lot of Coppermine users here - actually, we have a lot of "everything" users here, so anything you need, just ask <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />By the way, are you Portuguese? Spanish?<!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> Welcome to the Family Jorge <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> <br /><br />and your new home!<br /><br />We really are like family here.<br />So if you need anything,<br />just ask your new family!<br />We love to help <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
 
Back
Top