Jump to content

mkdir problem: permission denied


Kevin1991

Recommended Posts

I'm a novice PHP coder. I'm testing php using my own pc (http://localhost/).

 

I need help to create a folder using mkdir() and save registered user's file (file uploads,avatar etc.)

 

In this file C:\Inetpub\wwwroot\register\index.php,

I need to create a folder at C:\Inetpub\wwwroot\profiles\<username>

 

when I use the code like this: mkdir('..\profile\newuser01', 0775, TRUE);

result says error because permission denied.

 

but when I change it into mkdir('\profile\newuser01', 0775, TRUE);

It works but will create a folder at C:\

 

what should I do?

 

I saw some article says changing owner or permission at parent folder but I don't understand.

Link to comment
Share on other sites

Hi there,

 

With Windows you have to specify the entire path, so it would be,

 

mkdir(c:/Inetpub/wwwroot/profile/newuser01);

 

You do not need the mode as windows ignores this. The only thing you need to make sure is that IUSR_servername has write permissions on the folder.

Link to comment
Share on other sites

You need to go to the parent folder in My Computer.

 

You then need to right click the parent folder (I would probably choose your profile folder as the parent) then go into properties -> security -> add -> type the IUSR_servername (where servername is the name of your computer) and then give them read & execute/write/read permissions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.