Page 1 of 1
Creating a directory problem
Posted: Thu May 20, 2004 1:34 pm
by mjseaden
Dear All
I'm getting this error when using "mkdir(<dirname>, 0770)" on my Linux Apache server:
Code: Select all
Warning: stat failed for <root path>/upload/50cd23f1ec7bed66799da314534f8992 (errno=13 - Permission denied) in <root path>/admin on line 2356 Warning: MkDir failed (Permission denied) in <root path>/admin on line 2356 Warning: Unable to create
I've tried to set the upload directory to public read/write, and it seems to stick to that. Is there a common cause for this problem (which is probably the most likely situation?)
Many thanks
Mark
Posted: Thu May 20, 2004 1:48 pm
by launchcode
Remember that all PHP scripts run as "nobody" on Unix servers (i.e. as good as "anonymous - the lowliest of low") - so approach the permission denied error from this perspective to get around it, not from YOUR perspective.
Posted: Thu May 20, 2004 1:50 pm
by mjseaden
launchcode, can you clarify what you mean?
Posted: Thu May 20, 2004 1:57 pm
by launchcode
I mean that your PHP script runs as "nobody" - this is a default user account which has virtually no user/group rights to do anything on the server - least of all set a chmod of 770 which is trying to set full rwx for users/groups (of which it isn't a member).
Posted: Thu May 20, 2004 1:58 pm
by mjseaden
So how do I get around this? I set the directory to public read/write, what else do I need to do?
Cheers
Mark
Posted: Thu May 20, 2004 2:03 pm
by launchcode
You cannot get around it - user "nobody" will never have the right permission levels to perform a chmod 770 command.
Unless you happen to be able to run the CGI version of PHP? (rather than the Apache module)
Posted: Thu May 20, 2004 2:06 pm
by mjseaden
So how do I create a directory on my server using Apache? Or upload files?
Cheers
Mark
Posted: Thu May 20, 2004 2:20 pm
by mjseaden
How do I setup my server so that I can use the 'mkdir' command to make a directory on my server?
Many thanks
Mark
Posted: Thu May 20, 2004 2:25 pm
by mjseaden
Is anyone out there?
Cheers
Mark
Posted: Thu May 20, 2004 3:23 pm
by xisle
User 'nobody' will not have the appropriate permissions, as launchcode
has said. You will have to create upload directories under an account
with appropriate permissions, like your account.
Set the dir to 0777 so 'nobody' can upload.
Depending on the purpose of
the script you can also run command line version of the script under your account manually or with crontab.
Posted: Thu May 20, 2004 3:27 pm
by mjseaden
Hi Xilse,
Thanks for the help - I've solved it now. I've also set the Public attributes to 'execute' (giving an 0706 CHMOD). This has now worked, otherwise I wouldn't have been able to access the upload directory.
Cheers
Mark
Posted: Thu May 20, 2004 7:26 pm
by launchcode
706 isn't execute, what you've done is allow the "world" to read/write to that folder.
705 is execute (but will not work in this instance).