Page 1 of 1

making a new directory

Posted: Mon Feb 04, 2008 9:06 am
by aceconcepts
Hi,

I am trying to make a new directory using the following:

Code: Select all

mkdir("/text", 0777);
However, when I run the above code the following error is thrown: "Warning: mkdir(/test) [function.mkdir]: Permission denied in /home/mysite/public_html/mkdir.php on line 2".

Line 2 is the code shown above.

Any ideas why?

Re: making a new directory

Posted: Mon Feb 04, 2008 9:27 am
by Zoxive
PHP doesn't have permissions in that folder you are trying to make a folder.


More specificly, /folder, is trying to make it in root.

Literary /folder on a linux server.

Re: making a new directory

Posted: Mon Feb 04, 2008 9:37 am
by aceconcepts
So how do i go about making a new folder using code?

Re: making a new directory

Posted: Mon Feb 04, 2008 9:42 am
by Zoxive
aceconcepts wrote:So how do i go about making a new folder using code?
Same as you have as long as php/webserver has permissions(Inside the folder you are trying to make the folder(s)).

I would definitely not recommend making a new folder in the root of a server though.