0

I need to create a folder in PHP outside the web root.

The parent folder has 777 permissions.

If I call mkdir($dir); or mkdir($dir, 0777, true); it returns false and the folder isn't created.

However, if I call exec("mkdir ".$dir); the folder is created.

Is it normal?

Maxbester
  • 2,435
  • 7
  • 42
  • 70
  • Switch the errors on: http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php and let us know, what errors do you get? – user4035 Jun 13 '13 at 15:37
  • Okay it says: `Wrong parameter count for mkdir()`. May the path contain a `/` at the end? I mean should I write `/myPath/` or `/myPath`? – Maxbester Jun 13 '13 at 15:57

1 Answers1

0

Older versions of php had different parameters for mkdir.

Try mkdir($dir, permissions);

Example:

mkdir($dir, 0777);

But I recommend updating the version of php

immulatin
  • 2,118
  • 1
  • 12
  • 13