RE: [PHP-GENERAL] mkdir function and permissions HELP!
| From: | Jason | Date: | Thu, 15 Jun 2000 19:15:39 +0000 |
| Subject: | RE: [PHP-GENERAL] mkdir function and permissions HELP! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1990@lists.php.net to get a copy of this message | ||
Chris
0755 is just your standard octal permission set in Unix/Linux. If you do an
"ls -l" on that directory, you'll notice the permission list like this:
drwxr-xr-x (read=4 write=2 execute=1) The order goes (Owner/Group/World)
So 755 would be
Owner(read,write,execute[4+2+1]),Group(read,execute[4+1]),World(read,execute
[4+1]) or 755. The leading 0 is the sticky bit which you shouldn't worry
about right now. I'm guessing your webserver is running as user "nobody"
which generally goes under the World permissions and PHP doesn't have
permissions to create a directory there. Try this:
mkdir("/tmp/mydir",0755);
That will probably work because the permissions are set to world writable.
(0777) I'm sorry if I'm over-simplifying everything and you already know
all of this.
Jason
<snip>
> darn, I still get
> Warning: MkDir failed (Permission denied) in
> /home/epcra/html/admin/test.php3 on line 15
>
> Is this a setting that needs to be switched on the server?
>
>
> FYI...here is the code I'm using
>
> if (mkdir("/home/epcra/html/testdir",0755))
> {
> echo "Directory Creeated";
> }
> else
> {
> echo "Not Created";
</snip>
> -----Original Message-----
> From: Chris Hughes [mailto:chris@ecomshare.com]
> Sent: Thursday, June 15, 2000 12:34 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP-GENERAL] mkdir function and permissions HELP!
>
>
> is this mode a setting in apache? the 0755 did seem to work. Forgive me,
> its my first time working with apache
> "Jason" <jasonc@webpipe.net> wrote in message
> news:NEBBIJABFKPPGJFBNIGLIEDACIAA.jasonc@webpipe.net...
> > I'm not sure if this question has already been answered. If so please
> > disregard. The default for Unix/Linux for directories is 0755.
> I believe
> > if you leave the mode out of the function it will default to
> this as well.
> > You will want to remember that php runs as the apache user if
> it's run as
> a
> > module. So in most cases this is user 'nobody'. The user must have
> > permissions to create a directory or it won't work.
> >
> > Jason
> >
> > > -----Original Message-----
> > > From: Chris Hughes [mailto:chris@ecomshare.com]
> > > Sent: Thursday, June 15, 2000 11:20 AM
> > > To: php-general@lists.php.net
> > > Subject: [PHP-GENERAL] mkdir function and permissions HELP!
> > >
> > >
> > > Hi,
> > > I'm trying to use the mkdir function in php to create a simple
> > > directory
> > > on the server (we are running linux/apache) and I keep having a
> > > permissions
> > > problem. I don't understand what I should put in as the
> "mode" for the
> > > second argument for the mkdir function. Please someone help me...this
> is
> > > driving me insane.
> > > Thanks in Advance
> > > Chris
> > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
> > >
> > >
> >
> >
> > _______________________________________________________
> > Site Design, Hosting, and E-Commerce at www.webpipe.net
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
_______________________________________________________
Site Design, Hosting, and E-Commerce at www.webpipe.net