Jump to content

PHP mkdir / ftp permissions error.


DannyTip

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 ?
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.