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
https://forums.phpfreaks.com/topic/80612-mkdir-problem-permission-denied/
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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.