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
https://forums.phpfreaks.com/topic/24265-php-mkdir-ftp-permissions-error/
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

Archived

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

×
×
  • 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.