473,903 Members | 4,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mkdir permissions help

banning
42 New Member
Expand|Select|Wrap|Line Numbers
  1. while($row = mysql_fetch_array($getID)){
  2.         $id=$row['id'];
  3.         $dir='../picture_library/floorplans/'.$id;
  4.         mkdir($dir,0777);
  5.         chmod($dir,0777);
  6.     }
  7.  
ok this is really starting to kill me... i've bee on this for an hour now surfing the net trying to find a solution. I am using a test server that i run on my computer to build sites and then upload (not sure if that will have any bearing).

anyway what im trying to do is OBVIOUSLY set permissions to this directory i just created BECAUSE... later on there is an option to delete...

Expand|Select|Wrap|Line Numbers
  1. unlink('../picture_library/floorplans/'.$id.'');
  2.  
however everytime i goto delete it says i don't have permissions... and clearly when i created the directory i set the permissions (at least im sure i did). Anyway any and all help would be had. Thanks guys.

i just tried this i dont know if it will help but i ran

Expand|Select|Wrap|Line Numbers
  1. echo substr(sprintf("%o",fileperms('../picture_library/floorplans/'.$id.'')),-4);
  2.  
and got 0777

ok so now i just ran

Expand|Select|Wrap|Line Numbers
  1. is_executable();
  2. is_readable();
  3. is_writeable();
  4.  
and apparently the file is readable and writeable HOWEVER it is not executable... how can that be if it says the permissions are 0777
Dec 31 '07 #1
2 1464
Markus
6,050 Recognized Expert Expert
Expand|Select|Wrap|Line Numbers
  1. while($row = mysql_fetch_array($getID)){
  2.         $id=$row['id'];
  3.         $dir='../picture_library/floorplans/'.$id;
  4.         mkdir($dir,0777);
  5.         chmod($dir,0777);
  6.     }
  7.  
ok this is really starting to kill me... i've bee on this for an hour now surfing the net trying to find a solution. I am using a test server that i run on my computer to build sites and then upload (not sure if that will have any bearing).

anyway what im trying to do is OBVIOUSLY set permissions to this directory i just created BECAUSE... later on there is an option to delete...

Expand|Select|Wrap|Line Numbers
  1. unlink('../picture_library/floorplans/'.$id.'');
  2.  
however everytime i goto delete it says i don't have permissions... and clearly when i created the directory i set the permissions (at least im sure i did). Anyway any and all help would be had. Thanks guys.

i just tried this i dont know if it will help but i ran

Expand|Select|Wrap|Line Numbers
  1. echo substr(sprintf("%o",fileperms('../picture_library/floorplans/'.$id.'')),-4);
  2.  
and got 0777

ok so now i just ran

Expand|Select|Wrap|Line Numbers
  1. is_executable();
  2. is_readable();
  3. is_writeable();
  4.  
and apparently the file is readable and writeable HOWEVER it is not executable... how can that be if it says the permissions are 0777
files
When using unlink() the script that executes it must be in the same directory as the poor file being deleted.

directories
Try using rm_dir() to remove directories
:)
Dec 31 '07 #2
banning
42 New Member
files
When using unlink() the script that executes it must be in the same directory as the poor file being deleted.

directories
Try using rm_dir() to remove directories
:)
LOL the poor file haha... thats good stuff... but rmdir(); only deletes a directory that is empty. However i have found a solution on another forum, i haven't tried it yet but i'll go ahead and post it.

Expand|Select|Wrap|Line Numbers
  1. function RecursiveFolderDelete ( $folderPath ){
  2.     if ( is_dir ( $folderPath ) ){
  3.         foreach ( scandir ( $folderPath )  as $value ){
  4.             if ( $value != "." && $value != ".." ){
  5.                 $value = $folderPath . "/" . $value;
  6.                 if ( is_dir ( $value ) ){
  7.                     FolderDelete ( $value );
  8.                 }elseif ( is_file ( $value ) ){
  9.                     @unlink ( $value );
  10.                 }
  11.             }
  12.         }
  13.         return rmdir ( $folderPath );
  14.     }else{
  15.         return FALSE;
  16.     }
  17. }
  18.  
Dec 31 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1759
by: Shaun | last post by:
Hello! I can't seem to get paths and variables working together: import os a = 'books' os.chdir( '/test') os.mkdir("/test/"a) the last line does not seem to work. os.mkdir(a) makes the directory
1
1695
by: joelbyrd | last post by:
I'm trying to do a mkdir(), but I'm getting permission denied error, even though I've set the mode to 0777: mkdir($full_path, 0777). I also couldn't do a chmod successfully. The code is something like: mkdir("/home/httpd/vhosts/website.com/httpdocs/dev1/test_folder1", 0777); What's the problem?
5
9280
by: eoindeb | last post by:
I am trying to create a directory on Solaris using the mkdir() function. This works fine when I pass a string literal ("/etc/hosts") to mkdir, but if I try passing a directory pointer to mkdir, it returns a -1 error. The directory error works fine with fopen - does anyone know what I am doing wrong?? Here's a snippet of the code: int Check_Directory() //check for existence of directory - if not there, create the file { int status, ret...
30
7726
by: MikeC | last post by:
Good People, I'm writing a backup utility that uses a chdir() to go into the source directory (in which the files reside that I want to back up), so I don't want to use chdir() to get into the target directory (where the backup copies will be kept, on another drive). I can successfully test whether the target directory exists or not using findfirst(), but if it doesn't, I wanted to create it using mkdir(), but it doesn't like the path...
8
24567
by: vj | last post by:
How do I do the following unix command: mkdir -m770 test with the os.mkdir command. Using os.mkdir(mode=0770) ends with the incorrect permissions. Thanks, VJ
1
1901
by: B | last post by:
Hi, I am using mkdir to create a directory and upload files to it. Unfortunately the folder is accessible via the url to any user, which is creating problems. How can I manage permissions with mkdir so the folder is not availabe via the url path thanks :)
3
1698
by: fouadk | last post by:
hi everyone.... i am trying to create a folder in my home directory but that ain't working due to permission restriction my code looks like the following: <?php $path = "/home/fouad/testing"; if(mkdir($path,700,TRUE)) {print "success."; }else {print "failure.";} ?>
1
4462
Icecrack
by: Icecrack | last post by:
Good day/night, Im creating a script that creates a folder and moves files inside that folder, the only problem i'm having is when creating the folder if it does not exist, i have tried different methods, mainly come up with permissions denied. codes i have used:
2
4548
by: ezechiel | last post by:
Hi, I'm working on windows here.. i have a script that makes directories, subdirs (mkdir) and I afterwards set special permissions with xcacls trough a system call. But when I took a closer look at the advanced security permissions, I saw that mkdir makes permission inheritance, when creating the subdirectories: main dir is ok, but sub dir permissions: Inherited From: permissions inherited by
0
10003
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9851
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10882
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9692
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5897
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4312
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3327
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.