mkdir function create's apache owner dir's

bvvelzen

Verified User
Joined
Oct 30, 2003
Messages
82
Location
Netherlands
hello,

when a user of us tries to make a directory with the mkdir function in php it wil create it as user apache and not as the user itself. This causes the problem that our user cannot delete the folder.

Greetings,
 
If safe mode was on they wouldnt be able to use the shell functions in the first place... but without moving away from the standard php versions your not going to stop it being created by apache unfortunately.

Chris
 
PHP's built-in file manipulation functions are very, very limited. For my Installatron DirectAdmin plugin, I wrote this class for file manipulation in PHP: http://www.l0rdphi1.com/tools/filemanip.phps

For instance, in normal PHP rmdir can not remove any dir if it has files or sub-directories in it. Using my class, you can simply do this:
PHP:
$f = new FileManip('/path/to/your/workingdir');
$f->rm('thedir');
And it will do the rest.

You can even use wildcards, such as:
PHP:
$f->rm('thedir/*/cheese');
And you can work with multiple files at the same time:
PHP:
$f->mkdir(array('one','two'));
Of course, none of this will fix the fact that directories are created as 'apache'. This, however, may be of use to you: http://www.faqts.com/knowledge_base/view.phtml/aid/16339/fid/31

Good luck, Phi1.
 
Back
Top