Page 1 of 1

Creating directory

Posted: Mon Jul 30, 2007 3:09 pm
by Yourchild
I have a piece of code that looks like this:


if($makeDir) {
mkdir($pathToRoot.$uploadDir);
}


I am receiving a warning "Permission Denied". How do I obtain permission for creating this directory?

Posted: Mon Jul 30, 2007 3:17 pm
by onion2k
If you're running PHP in safe_mode then mkdir() will be unavailable. There's no way around it.

If you're not, then check that the directory you're trying to make the new directory in is writeable.

Posted: Mon Jul 30, 2007 3:19 pm
by feyd
If the directory is outside your web-root, you'll typically need to talk to the host, or do it manually within your control panel. If the directory is inside your web-root, when disallowed, your host has likely chosen to not give php that permission due to security concerns.

Are you sure the directory is correctly located and set?

Posted: Mon Jul 30, 2007 3:31 pm
by nathanr
it also depends where the link is relative to.. I've noticed on a few of boxes that apache is only allowing mkdir to run when specifying the directory by relative link, rather than absolute path.. (also check you don't have a slash missing..

try just mkdir('testdir') and see where it ends up, then write a rel path to where you want :)