Directory creation permission in PHP?

Gerald Combs gerald at ethereal.com
Fri Dec 21 15:03:19 CST 2001


On Fri, 21 Dec 2001, Bradley Miller wrote:

> Has anyone tried to create a directory (MKDIR) in PHP?   I'm wanting this
> new program I'm working on to check if a directory exists, and if it
> doesn't, I want it to create it on the fly for the user.  I've tried
> various examples, but I keep getting permissions errors.  If I FTP into my
> site area I can create and chmod the permissinos on a directory to what I
> need, but that's not exactly automated.

Is the PHP script running under your web server or standalone?  If it's
running under your web server, make sure your web server user has write
access to the parent directory you're working in.  The user Apache runs as
is specified by the "User" directive in httpd.conf.  Older distros use
'nobody' (which can be a Bad Idea security-wise); newer ones usually
create a separate user, e.g. 'http'.

> 
> Any suggestions?
> 
> Thanks!
> 
> -- Bradley Miller
> 
> 
> 




More information about the Kclug mailing list