Forum Moderators: bakedjake

Message Too Old, No Replies

owner of file is apache - can't change

         

jackvull

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

10+ Year Member



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?

crevier

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

10+ Year Member



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.)

jackvull

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

10+ Year Member



why 666 and not 777?

crevier

8:40 pm on Jul 3, 2006 (gmt 0)

10+ Year Member



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).