Page 1 of 1

Creating directory

Posted: Thu Nov 11, 2004 4:05 pm
by Shendemiar
What directive controls if the php is allowed to create and delete directories?

Posted: Thu Nov 11, 2004 4:21 pm
by liquid
Im not sure if this is what your looking for but

$someDirName=somedirname <--- can be given value dynamically if necessary.

Code: Select all

$pathname = "yourPath".$someDirName;

$old = umask(0);
mkdir($pathname, 0777);
chmod($pathname, 0777);
umask($old);
The above code should create the dir and give it proper permissions to write to it.

hope it helps a bit if not check out
http://www.php.net

Posted: Thu Nov 11, 2004 4:26 pm
by Shendemiar
Thanks, but my problem is, that the abouve doesn't create anything. Must be some serverside setting...

Posted: Thu Nov 11, 2004 4:33 pm
by liquid
The one thing you have to make sure of is that the intitial dir you are trying to create the new dir in, must be given full permissions. I had to connect through an ftp program and manually give the main dir full permissions then it seemed to work fine.

Posted: Thu Nov 11, 2004 5:21 pm
by Shendemiar
Correct.

Now i can make dir's.

When i check them with ftp, permissions are just the same on php made and ftp made dirs, BUT

Those made with php i can't uplad anything via php, but those made with ftp i can upload via php. Via ftp both are uploadable.

Posted: Thu Nov 11, 2004 5:51 pm
by liquid
Could you post some code so I can take a look at whats going on?

Im out today, but will reply more in the morning if you still need some help.

liquid

Posted: Thu Nov 11, 2004 6:40 pm
by Shendemiar
liquid wrote:Could you post some code so I can take a look at whats going on?

Im out today, but will reply more in the morning if you still need some help.

liquid

drwxrwxrwx 2 httpd customer 4096 Nov 12 02:22 phpmade_dir
drwxrwxrwx 2 jat**** jat***** 4096 Oct 14 06:17 ftp_made_dir

That's the problem...