Jump to content

Archived

This topic is now archived and is closed to further replies.

DannyTip

PHP mkdir / ftp permissions error.

Recommended Posts

Im using php to create a directory on the server when a user on my script is added. Using the following..
[code]mkdir("../client/images/".$imgdir."/", 0755);
mkdir("../client/images/thumbnails/".$imgdir."/", 0755);[/code]All this works prefectly fine.  The problem comes when the user then tries to log in via ftp and upload files into this directory to which permission denied errors are returned.  Its possible for the user to delete the directory fine but they are not allowed to upload files into it.  Is there anyway arround this?

Im guessing its a problem todo with users where 'apache' owns the directory.  but surely the permission 755 allows any user to read/write ?

Share this post


Link to post
Share on other sites
Try 766, that gives the owner of it rwx, groups rw- and others rw-. 755 is r-x, which is read and execute not write

Share this post


Link to post
Share on other sites
I tried 0766 and 0777 but the directory created still seams to be 755 according to my ftp client.

Share this post


Link to post
Share on other sites
After some playing around and realising i was uploading the wrong file  :'(

766 is producing a chmod of 744
777 is producing a chmod of 755
666 is producing a chmod of 644

Share this post


Link to post
Share on other sites
Odd, i tried this on my linux box via phpcli

[code=php:0]
<?
mkdir( "test", 0766 );
exec("touch test/testfile");
?>
[/code]
[code]
[~] $ php t.php
[~] $ ls -al
drwxr--r--  2 rab  users  4096 2006-10-17 17:46 test
[~] $ ls -al test
total 8
drwxr--r--  2 rab users 4096 2006-10-17 17:46 .
drwxr-xr-x 58 rab users 4096 2006-10-17 17:46 ..
-rw-r--r--  1 rab users    0 2006-10-17 17:46 testfile
[/code]


Wierd how it's drwxr--r--  when it should be drwxrw-rw- but the file still wrote

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.