What version of PHP are you using?
Also, did you read the first user comment on the [man]mkdir/man page?
dev at grind dot lv wrote:Another simple recursive mkdir function:
function Rmkdir($path){
$exp=explode("/",$path);
$way='';
foreach($exp as $n){
$way.=$n.'/';
if(!file_exists($way))
mkdir($way);
}
}
EDIT:
halojoy wrote:If you are on windoes, like me,
you can use only:
mkdir('test');
Not true... I'm running PHP 5.2.3 on Windows XP, and executed this code:
var_dump( mkdir('test/test2/test3/test4', 0700, TRUE) );
Result was bool(true) and the directories were created as expected.
EDIT2: Also, jnfields, are you sure you want to create a directory called "test2" in the root of the server? If you're trying to create a directory in the root of your website (ex. http://yoursite.com/test/test2/test3/), you need the full path, ex. /home/username/public_html/test/ (unless your server is configured such that the root directory you see ( / ) is actually your home directory, though I've never personally used any server with such a configuration, nor do I know if this is possible). You can usually achieve this by doing:
mkdir($_SERVER['DOCUMENT_ROOT'] . '/test/test2/test3', 0700, TRUE);
What happens if you try that code?