On Wednesday 24 July 2002 11:12, Roger Lewis wrote:
> I'm trying to learn to create a directory in php, and from everything I've
> read I created this simple test that I put into the file add_user_dir.php.
> Unfortunately I can't get it to work.  I am getting the error message:
> Warning: MkDir failed (Permission denied) in
> /home/sites/home/users/demo/web/Admin/add_user_dir.php on line 20.
> Obviously, it has something to do with permissions.  I have chmod for the
> directory 'userforum' set to 0777.  I tried playing around with umask, and
> changing the chmod, but I can't get anything to work.


> <?php
> $dirpath = "/home/sites/home/users/demodocs/web/userforum" . $username;
> mkdir($dirpath, 0777);
> ?>

Assuming $username is 'tom', are you trying to create:

a)  /home/sites/home/users/demodocs/web/userforumtom


b)  /home/sites/home/users/demodocs/web/userforum/tom

Your code is trying to do (a). In any case whatever you're trying to do, you 
need both the following:

i) Have execute permissions ('x') on all the directories in the path leading 
down to where you wish to create your directory

ii) Have write permission ('w') on the directory in which you are creating 
your directory

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

"I will make no bargains with terrorist hardware."
-- Peter da Silva

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to