Welcome to WebmasterWorld Guest from 35.153.73.72

Forum Moderators: bakedjake

Message Too Old, No Replies

owner of file is apache - can't change

     
7:52 pm on Jun 29, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 16, 2005
posts:486
votes: 0


I thin k a PHP script created a folder and files in a directory but I cannot delete them even with shell access to the server.

I do a ls -l on the folder and it says all the files are owned by apache.

Is there a way to delete these?

9:04 pm on June 30, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 19, 2005
posts:44
votes: 0


When a php or perl script creates a file on the server, it's actually apache doing it. So apache owns it, and if the permissions are set a certain way, then only apache can edit or delete such files. For that reason, when I create files in my CGI scripts, I immediately set the permissions on the file to be 666 so any user can edit or delete them at the shell.

I have the same problem on my server with some files that were uploaded via WordPress. The solution is to use a web-based program to navigate through your file system and delete the unwanted file(s), because this would actually be apache doing the work, so it has the proper permissions.

Many web host providers have a web-based account maintenance utility available, so I suggest checking there first. If they don't, then your only alternative is to write your own or download one. Maybe check those free script web sites, and search on "file maintenance" or "site maintenance".

(I'm gonna write my own one of these days.)

11:14 am on July 3, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 16, 2005
posts:486
votes: 0


why 666 and not 777?
8:40 pm on July 3, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 19, 2005
posts:44
votes: 0


666 sets the file wide open for reading and writing by anyone, which is what we're talking about here. 777 would work too, but that also makes it executable (which based on your post is not necessary).