Page 1 of 1

Creating Folders/Directories

Posted: Thu Jul 22, 2004 4:17 am
by kevin_javia
Greetings,

I am trying to create folders using my script.

Code: Select all

<?php
if (!is_dir("full/$uid"))
{
	$oldmask = umask(0); 
	mkdir("full/$uid",0777);
	umask($oldmask);
}
if (!is_dir("thumb/$uid"))
{
	$oldmask = umask(0); 
	mkdir("thumb/$uid",0777);
	umask($oldmask);
}
if (!is_dir("full/$uid/$c_id"))
{
	$oldmask = umask(0);
	mkdir("full/$uid/$c_id",0777);
	umask($oldmask);
}
if (!is_dir("thumb/$uid/$c_id"))
{
	$oldmask = umask(0); 
	mkdir("thumb/$uid/$c_id",0777);
	umask($oldmask);
}
?>
if $uid = 1 and $c_id = 2 are the values, folder "..../thumb/1" and folder "..../full/1" are created. But not " "..../full/1/1" and "..../thumb/1/1".
Here "full" and "thumb" both have 0777 chmod.

Script is giving error like mkdir(): SAFE MODE Restriction in effect.

What can be the problem? :?

Thanks for reading this far.

Kevin.

Posted: Thu Jul 22, 2004 4:27 am
by ol4pr0
Trun off save mode in php.ini :)

Posted: Thu Jul 22, 2004 4:35 am
by kevin_javia
How can I do this using script?

Posted: Thu Jul 22, 2004 7:21 am
by ol4pr0
You cant.. you will have to edit php.ini

around line 160

; Safe Mode
;
safe_mode = Off

Posted: Fri Dec 03, 2004 11:35 am
by John Cartwright
what about

Code: Select all

ini_set(SAFE_MODE, 0);

Posted: Fri Dec 03, 2004 12:46 pm
by rehfeld
Phenom wrote:what about

Code: Select all

ini_set(SAFE_MODE, 0);
can only do that in php.ini







kevin_javia-
i ran into this problem too. you just simply cannot do what your trying to do if safe mode is on.

the only workaround i was able to do, was to use php's ftp functions to log into your own website, and either make the directories that way, or change the owner of the directories and the permissions too if neccesary.

ftp isnt very fast though, so if speed is very important, start looking for a solution to your problem that doesnt involve creating directorys on the fly which php must write to, or, get a host that doesnt use safemode.