making a new directory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

making a new directory

Post 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?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: making a new directory

Post 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.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: making a new directory

Post by aceconcepts »

So how do i go about making a new folder using code?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: making a new directory

Post 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.
Post Reply