0

Yesterday I've looked at all the info about this problem that i could but nothing worked. I'm getting this error:

Warning: mkdir() [function.mkdir]: Permission denied in /home/diligenceh/domains/diligencehelps.com/public_html/php_includes/form_check.php on line 32

On line 32 I got this code:

if(!is_dir(__DIR__ . "/memberFiles/$id"))
    {
line 32->     mkdir(__DIR__ . "/memberFiles/$id", 0755);
    }

Id outputs a required number.I already got memberFiles folder in my computer and in my website.I'm using Windows 7,Apache.I'm not really good at anything with apache so if it's causing a problem(as I've read many times) please tell me more detailed help with apache.Thanks.

Donny
  • 47
  • 1
  • 8
  • Looks like the user running PHP doesn't have write permissions to that directory. I'd `chmod` the folder, and (maybe - depending on the `chmod`) `chown` it, too. More info about file system permissions here: http://stackoverflow.com/questions/24612406/file-system-permissions/24612797#24612797 (Although, it's *nux based) – ʰᵈˑ Jul 08 '14 at 09:13
  • user which run php interpreter process can access (write priv) parent directories? – itnelo Jul 08 '14 at 09:14
  • I understood what both of you,hd and itnelo wanted to say and yes,that might be the problem, but I'm not really sure how to use this chmod/chown. – Donny Jul 08 '14 at 09:16
  • @Donny have a read of this http://stackoverflow.com/a/11389857/3000179 – ʰᵈˑ Jul 08 '14 at 09:18

1 Answers1

0

I think this happen because of you don't have write permission.

check with this code line -

if(!is_dir(__DIR__ . "/memberFiles/$id"))
    {
       mkdir(__DIR__ . "/memberFiles/$id", 0777);
    }

and also check that $id is set correctly (folder name)

I think this will helpful to you.

Thanks

Sri
  • 496
  • 1
  • 5
  • 20
  • your development environment is, Apache run on windows 7 environment.. if it is so there only two thing can be happen... **check your "memberFile" folder permission** and **check your file path is correct** you can debug your code using static path without any variables.. doing like this you can find the issue ... check your folder permission and try with static path... thanks – Sri Jul 09 '14 at 04:14