Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Folder Permissions
07-28-2012, 09:59 PM #1JunseeGuest
I am having trouble implementing code for setting "Access All" on the folder permissions for my web folder.
I've tried a number of lines of code but I can't seem to get it right. I am running a script install.php from a test folder
I want to make /test/ 0777 permission, and it currently is set at 0755
$FullPath = $_SERVER['DOCUMENT_ROOT']. '/Test';
chmod($FullPath, 0777) or die ("Permission not granted for root");
$FullPath = '../Test';
I have set perrimisions on this webserver before, so I can't understand why it refuses to work. In those cases I created folders first and then set the chmod, as I have a server that doesn't allow direct setting of mkdir permission, for whatever reason (which reminds me the webserver is linix based). The only thing I can think of is that some how you can't set permission of folder you are in?
Going crazy ... and thanks in advance
07-28-2012, 11:31 PM #2
- Join Date
- Sep 2010
- Thanked 226 Times in 226 Posts
Here's some code from one of my pages.
You can't apply chmod to the whole path, only to the directory, without the end slash. 'my_path' in the above code is the whole path.PHP Code:
if ((!file_exists($_SESSION["path"]))&&($_FILES['userfile']['name'] != "" ))
die('You cannot upload to the specified directory, please CHMOD it to 777.');