Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mkdir() not working

Tags:

php

mkdir

My code

mkdir("/some/absolute/path",0777);

and

mkdir("relative/path", 0777);

is not working, safe mode is turned off, and I've even tried setting all of the parent folders to 777.

Any ideas?

EDIT: I do have error reporting turned on, in my frustration I've 777'd the whole path just to make sure that, that isn't the issue. It's gotta be something stupidly simple going on.

EDIT EDIT: Upvotes for everyone who responded with suggestions... But I'm not going to select an answer since this still isn't resolved, but then again I think this is going to be one of those ones left open forever.

EDIT x 3: So I have the most unsatisfactory resolution to this question ever... I started with a clean VM image, retried it and it works now. No joke.

like image 704
Mike Keller Avatar asked Jun 24 '10 18:06

Mike Keller


2 Answers

Make sure the parent directories have correct write permissions, that was my problem

like image 193
brandon Avatar answered Oct 13 '22 08:10

brandon


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);
like image 36
Declan Land Avatar answered Oct 13 '22 07:10

Declan Land