In article <1cdca2a7.0407280914.1ae586e@posting.google.com> , Phil Powell wrote:[color=blue]
> [PHP]
> print_r(is_file("$logPath/$logFileName")); // RETURNS 1
> unlink("$logPath/$logFileName"); // RETURNS WARNING: PERMISSION DENIED
> [/PHP]
>
> This code should tell me that the file located at
> $logPath/$logFileName should delete the log file, however, it never
> deletes it due to permissions error.
>
> However, upon checking the file properties I find this:
>
> This file was created and transferred the same way as all others, is a
> text file and contains only text, no binary characters of any kind.
> However, it can never be deleted even though I have permissions to do
> so as does Apache.
>
> What could I be doing wrong?[/color]
Are you able to delete it using the shell and/or FTP?
I'm assuming UNIX. (Because I can't help much with windows..)
My first guess is that Apache is "running as" another user. Assuming
you've already tried it..
Is it possible the directory was chmod'd?
Is Apache serving content from a directory mounted via NFS? (If so,
could the filesystem have been mounted read only?)
One thing to check is if Apache is able to create files in the same
directory. If so, then you can be reasonably sure the problem is with
the file itself.
If Apache can create files in the same directory, do a compare on file
ownerships.
Another thing to check, if you've got shell access are any extended
attributes. lsattr might do the trick if it's an ext* file system. I've
spent a few hours puzzling over that one before. :-) chattr is a handy
way to keep your "kid sister" or root from accidently zapping critical
files. Sometimes log files are set with an "append only" attribute.
Jamie
--
http://www.geniegate.com Custom web programming
User Management Solutions Perl / PHP / Java / UNIX