Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-03-2002, 12:48 AM   PM User | #1
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
deleteing directories

How can I delete files that were made by the server in ftp? Everytime I try I get "Permission denied". Do I have to delete them by a script or something? I've tried everything I can think of. Changing permissions, changing chmod, etc
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 07-03-2002, 01:11 AM   PM User | #2
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,901
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
yes you will need to use a script to delete the files , or change the ownership of the files, & since some hosts wont let you CHOWN then deletion is probably easiest.

<?
unlink('filename.file');
?>
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 07-03-2002, 01:16 AM   PM User | #3
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
oops, I meant a whole directory, which has loads of other directories, not files.
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 07-03-2002, 02:39 AM   PM User | #4
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
I've tried renaming and unlinking, both come up with permission denied.

Warning: Rename failed (Permission denied) in /home/chatterspics/public_html/clear.php on line 3

The directories are chmoded to 777, if that helps
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 07-03-2002, 08:50 AM   PM User | #5
Jeewhizz
Regular Coder


 
Join Date: May 2002
Location: London, England
Posts: 369
Thanks: 0
Thanked 0 Times in 0 Posts
Jeewhizz is an unknown quantity at this point
www.php.net/rmdir

Try that

Jee
__________________
Jeewhizz - MySQL Moderator
http://www.sitehq.co.uk
PHP and MySQL Hosting
Jeewhizz is offline   Reply With Quote
Old 07-03-2002, 08:53 AM   PM User | #6
Flamerule
New Coder

 
Join Date: Jun 2002
Location: Paris, France
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Flamerule is an unknown quantity at this point
I guess You probably need to have all files in your directory to be correctly chmodded...
__________________
I don't suffer from insanity, I enjoy every single minute of it!
Flamerule is offline   Reply With Quote
Old 07-03-2002, 09:42 AM   PM User | #7
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,901
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
hmmm OK - you can try this BUT BE VERY CAREFUL!!!!!

exec('rm -f -R thisdirectory');

and I mean careful cos if you get this wrong you get it wrong bigtime! that should remove the directory and all its contents including subdirectories.

again BE CAREFUL !!
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 07-03-2002, 02:08 PM   PM User | #8
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Ok, I execute that in the directory I want to delete, or name "thisdirectory" to the directory I want to delete? I don't wanna mess it up :s
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 07-03-2002, 09:18 PM   PM User | #9
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
That didn't delete anything :s
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 07-03-2002, 09:50 PM   PM User | #10
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Just trie everything on this page

http://www.php.net/manual/en/function.rmdir.php

Nothing worked.
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 10-25-2002, 12:11 AM   PM User | #11
gorilla1
Regular Coder

 
Join Date: Jun 2002
Posts: 544
Thanks: 0
Thanked 0 Times in 0 Posts
gorilla1 is an unknown quantity at this point
My host told me that this has to do with the PHP script not "running as user". They say that you want to use a perl script to perform these kinds of operations (especially if you dont want the directory to have universal write access). Does this make sense? Is it possible to call a perl script from a php script in order to perform some of these sensitive operations, or is that a mistake?

G
gorilla1 is offline   Reply With Quote
Old 11-24-2002, 07:59 PM   PM User | #12
gorilla1
Regular Coder

 
Join Date: Jun 2002
Posts: 544
Thanks: 0
Thanked 0 Times in 0 Posts
gorilla1 is an unknown quantity at this point
I finally got this to work. Again, on my host, php does not run with the authority needed to do deletes, renames, etc. So in my php script, I set up a call to a cgi written in perl that handles those actions. It works.

G
gorilla1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:04 PM.


Advertisement
Log in to turn off these ads.