mkdir() not working

If anyone gets stuck with this problem.. there's one answer I can give you that I spend 2 hours on finding.. I tried with using a full path, and "../mydirectoryname".

Try using:

mkdir("./mydirectoryname", 0777, true);

Instead of..

mkdir("../mydirectoryname", 0777, true);

Do all of the parent directories exist?

If not, you'll need to enable recursion (assuming PHP5 here):

mkdir('/path/to/your/dir',0777,true);

EDIT: Didn't see the hidden comment saying that every directory from var downward was set to world-writable, so I'm betting the directory path exists and the above won't be helpful. Sorry!


Are you trying to create those directories recursively, like you would do with mkdir -p on the command line? If so, specify true as the third parameter to mkdir.

And just to echo the previous suggestions, PLEASE specify the error messages you are getting. If you are not getting any, use this before your call: error_reporting(-1); // ALL messages and ini_set('display_errors', 'On');.

Tags:

Php

Mkdir