// Create user directory
/* $user-id is a variable that contains the use name from a form field,
that's how I name my new directories, u can use whateve u want*/
mkdir ( "/path/to/dir/$user_id", 0755 )
or die ( "Could not create custom user directory." );

- Vic

-----Original Message-----
From: Simon Ritchie [mailto:[EMAIL PROTECTED]] 
Sent: Monday, August 12, 2002 2:50 PM
Subject: RE: [PHP] exec / mkdir question

> > i'm using the following code to create a directory :-
> >
> > $temp = exec("mkdir $path");
> >
> > it doesn't work...
> >
> > i've validated the $path var which is correct.  i suspect it is a
> > permissions issue.
> >
> > what should i look for to resolve this?

> Try using the mkdir function:

That is good practice, but if the problem is with the  permissions, the
program will just be better written when it fails.

A note of the error message and some information about the host
would help.  However ...

The user running the PHP script needs to be able to create the file.  If
this is a UNIX system and the web server is run by the user nobody, then
that user needs write access to the directory which will contain the
To grant that access, your user (the one you, er, use to connect to the
server) must own the directory

The worst case is when your user and the web server user are not in the
group.  In that case, you will need to grant write access to all users.
This introduces potential security risks - any user can also remove or
rename files in that directory.

Simon Ritchie

Download my introduction to PHP for $25:

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

Post your ad for free now! http://personals.yahoo.ca

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

Reply via email to