PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old December 23rd, 2003, 08:08 PM
Alicia Alicia is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 116 Alicia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 49 sec
Reputation Power: 5
delete php created folder

Hi guys,

I have written a php code that create a folder and then copy some files from one folder in the server into it.

The flow is like this. When the administrator click on the copy button i created, it will do the task by running the file i created (as mentioned above).

After successfully created the folder and copied the files, i tried to delete it from ftp.

Now this is the prob:
The problem is can't delete it anymore because it says operation not permitted. Why i can't delete the folder created and files i copied ?? i When i check the owner from my files manager, i found that the owner for the folder created by the php code is WWW and not my username... why is that so ?? i guess that is the reason why i can't delete the files or folder.

since i am not WWW user, how could i delete the files now ?? is it if i create files or copy files by using by using php, it will automatically set the owner as WWW and not my username ??

please advise.

Reply With Quote
  #2  
Old December 24th, 2003, 07:21 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Correct. The Web server can only create files using its username, which is typically either www or nobody. You could try having the script chown the file or change the group and permissions to a group your user belongs to so that you can then go in and delete.

Reply With Quote
  #3  
Old December 25th, 2003, 07:41 PM
Alicia Alicia is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 116 Alicia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 49 sec
Reputation Power: 5
i have chmod the folder to 777 but it is not working... is it i have chmod all the files inside instead just the folder ?

Reply With Quote
  #4  
Old December 26th, 2003, 11:58 PM
Mike_r Mike_r is offline
ExoCrew
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 68 Mike_r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
You must have your php script run this function:

chgrp()

Hope that helps.
__________________
ExoHelpDesk
ExoCrew Free Services

Reply With Quote
  #5  
Old December 29th, 2003, 07:37 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Right, the folder might be 777, but if the individual file permissions don't allow the www user to delete them, you're SOL. It's generally not considered a great idea to have 777 permissions, by the way.

Reply With Quote
  #6  
Old December 29th, 2003, 07:19 PM
Alicia Alicia is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 116 Alicia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 49 sec
Reputation Power: 5
is it i need to use this code ?

chgrp ( $folder, WWW)
rmdir($folder)

please advise.

Reply With Quote
  #7  
Old December 30th, 2003, 07:52 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
If the files aren't already owned or writable by the www user, you won't be able to use php to change the permissions or group/ownership. You'll need to log into the shell and issue "chgrp www *".

Also, I'm not sure about this, but I suspect you'll need to delete all the files in the folder prior to removing the folder. Look into the unlink() command to handle this.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > delete php created folder


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway