Page 1 of 1

Code inside function loses permissions?

Posted: Wed Apr 15, 2009 12:27 pm
by Gatzy118
I have some code, for example

Code: Select all

mkdir($dir);
but as soon as it goes inside a function and i call it, i get an error saying Permission denied :s

Re: Code inside function loses permissions?

Posted: Wed Apr 15, 2009 12:32 pm
by Christopher
You need to pass $dir to the function, like this:

Code: Select all

function foo($dir) {
     mkdir($dir);
}

Re: Code inside function loses permissions?

Posted: Wed Apr 15, 2009 12:34 pm
by Gatzy118
i understand that but as soons as i do that, any commands within the function that edit the filesystem say permission denied. Is it to do with the configurstion of the PHP? is it fixable with an .htaccess file?

Re: Code inside function loses permissions?

Posted: Wed Apr 15, 2009 1:59 pm
by Christopher
It should not matter where the mkdir() is. My guess is that the value of $dir is different, hence the error. Print the value and see.