Problem with mkdir command...

Hi there,
I am trying to create a directory with mkdir but its not working when i try it on my site. Its working 101% find while i chk on localhost. below is the code i am using:

mkdir("./usr/user1/mydir", 0777);

even i tried it after removing ./ from the beginning but that was or no use :(. Pls. spare a couple of seconds to help me into this.

Thnx a million for your kind favor.

Do you get any errors? What happens when you do run it? If you get a blank page or just nothing, make sure errors are turned by using error_reporting(E_ALL);

At the top of the page. This will force errors to display, errors that may give insight into what is going wrong.

Smells like ‘Permission Denied’ to me.

hi there,
thnx for your kind reply. I turned on error messeging and it dispalyed - Warning: SAFE MODE Restriction in effect. The script whose uid is 3245 is not allowed to… Can i set safe mode to off on runtime. What kind of security issues may occure if i do so. Please spare some more time and help me to come up with this issue.

thnx.

safe mode cann’t be turned of during runtime.
its a securety feature witch can only be set in the php.ini or httpd.conf

to solve this u have to contact ur provider, but i think he will lower the secutity for u.
an other thing u could do is letting the provider change the UID of the folder u wanna access. This shoudn’t be a big problem.

or cange ur provider if they arn’t willing to help u.

u can’t do anything about it yourtself.

thnx q1712,
even i browsed a lot of sites to find the solution of my problem. but it seems to be the same issue everywhere. What i learned with those examples is that it will always allowes the user to create a directory even if the safe mode is on but if you try to create a subdirecty within that directory, it will bounce an error telling that some UID not matching. This is becasue that master directory was created with the UID used by apache server and sub-dir will be created with the current UID (i don’t know if i am write everywhere i wrote here).
Don’t you think this is wat happening in my case too???

one more thing, i just saw this site which tells something about safemodehack but didn’t get full idea (as i m a new bie in php field). Can you please have a look at this url: http://wiki.splitbrain.org/wiki:safemodehack

with php its possible to use ftp connections.
this creates a ftp-connection to localhost to do the fileoperations.
it works (at least when ur provider supports passive-mode-ftp), but i woudn’t consider it to be good coding.

mkdir(“ftp://user:[email protected]/usr/user1/mydir”, 0777);

since my last post i started wondering why the folder and the script have difrent UID’s. have u created the usr/ folder by php?

Sponsor our Newsletter | Privacy Policy | Terms of Service